Package com.syzygy.events.database
Class Facility
- All Implemented Interfaces:
Database.Dissolvable
,Database.UpdateListener
An instance of a facility database item
- A facility can be edited except for the organizer
-
Nested Class Summary
Nested classes/interfaces inherited from class com.syzygy.events.database.DatabaseInstance
DatabaseInstance.DeletionType, DatabaseInstance.InstancePropertyWrapper<W extends DatabaseInstance<W>>, DatabaseInstance.PropertyField<V,
W extends DatabaseInstance<W>>, DatabaseInstance.PropertyWrapper<V, W extends DatabaseInstance<W>> Nested classes/interfaces inherited from interface com.syzygy.events.database.Database.UpdateListener
Database.UpdateListener.Type
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final DatabaseInstance.PropertyField<?,
?>[] The list of the fields defined for a UserFields inherited from class com.syzygy.events.database.DatabaseInstance
db, iproperties, properties
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Facility
cast()
Gets this instance casted to the generic typeReturns the name that should be given to the image instance.android.location.Address
getFullAddressFromGeo
(android.content.Context context) static android.location.Address
getFullAddressFromGeo
(android.content.Context context, double lat, double lng) static android.location.Address
getFullAddressFromGeo
(android.content.Context context, com.google.android.gms.maps.model.LatLng latlng) static android.location.Address
getFullAddressFromGeo
(android.content.Context context, com.google.firebase.firestore.GeoPoint geo) getImage()
com.google.android.gms.maps.model.LatLng
com.google.firebase.firestore.GeoPoint
getName()
NewInstance
(Database db, String name, com.google.firebase.firestore.GeoPoint location, String address, String description, android.net.Uri image, String organizerID, Database.InitializationListener<Facility> listener) Creates a new Image instance in the database using the given data.boolean
setAddress
(String address) boolean
setDescription
(String val) void
setFacilityImage
(android.net.Uri image, Consumer<Boolean> onComplete) Sets the Image instance.boolean
setLocation
(com.google.firebase.firestore.GeoPoint val) boolean
protected List<android.util.Pair<com.google.firebase.firestore.Query,
Database.Collections>> update
(String name, com.google.firebase.firestore.GeoPoint location, String address, String description, android.net.Uri image, Consumer<Boolean> onComplete) Validates an updates all properties of the facility.update
(String name, com.google.firebase.firestore.GeoPoint location, String address, String description, Consumer<Boolean> onComplete) Validates an updates all properties of the facility.Methods inherited from class com.syzygy.events.database.DatabaseInstance
addInitializationListener, addListener, assertNotIllegalState, deleteInstance, dereferenceInstance, dissolve, dissolve, doesPropertyLoadInstance, fetch, fetch, fullDissolve, getAssociatedImage, getCollection, getCollectionReference, getData, getDatabaseID, getDocumentID, getDocumentReference, getFields, getPropertyInstance, getPropertyInstanceI, getPropertyValue, getPropertyValueI, initializeData, isDataValid, isDataValid, isLegalState, isPropertyEditable, isPropertyValid, isPropertyValid, isReferenced, modifyData, notifyUpdate, onUpdate, processUpdate, removeListener, requiredFirstDelete, setAssociatedImage, setPropertyInstance, setPropertyValue, subDereferenceInstance, subInitialize, toString, updateDataFromDatabase, updateDataFromMap, updateDataFromMap
-
Field Details
-
fields
The list of the fields defined for a User
-
-
Constructor Details
-
Facility
Checks to make sure the generic type is the type of this instance- Parameters:
db
- The databaseorgID
- The id of the organizer- Throws:
ClassCastException
-
-
Method Details
-
cast
Description copied from class:DatabaseInstance
Gets this instance casted to the generic type- Specified by:
cast
in classDatabaseInstance<Facility>
- Returns:
- This as the generic type
-
getName
-
setName
-
getLocation
public com.google.firebase.firestore.GeoPoint getLocation() -
setLocation
public boolean setLocation(com.google.firebase.firestore.GeoPoint val) -
getDescription
-
setDescription
-
getAddress
-
setAddress
-
getFullAddressFromGeo
public android.location.Address getFullAddressFromGeo(android.content.Context context) -
getLatLngLocation
public com.google.android.gms.maps.model.LatLng getLatLngLocation() -
getFullAddressFromGeo
public static android.location.Address getFullAddressFromGeo(android.content.Context context, com.google.firebase.firestore.GeoPoint geo) -
getFullAddressFromGeo
public static android.location.Address getFullAddressFromGeo(android.content.Context context, com.google.android.gms.maps.model.LatLng latlng) -
getFullAddressFromGeo
public static android.location.Address getFullAddressFromGeo(android.content.Context context, double lat, double lng) -
getAssociatedImageLocName
Description copied from class:DatabaseInstance
Returns the name that should be given to the image instance. If no image is associated, returns null- Overrides:
getAssociatedImageLocName
in classDatabaseInstance<Facility>
-
getImageID
-
getOrganizerID
-
getImage
-
setFacilityImage
@StirsDeep(what="The previous Image") public void setFacilityImage(@Nullable android.net.Uri image, Consumer<Boolean> onComplete) Sets the Image instance. This function will create a new reference to the instance.- Parameters:
image
- The new instanceonComplete
- called on completion with if the update was successful- See Also:
-
getOrganizer
-
update
@StirsDeep(what="The previous image") public Set<Integer> update(String name, com.google.firebase.firestore.GeoPoint location, String address, String description, android.net.Uri image, Consumer<Boolean> onComplete) Validates an updates all properties of the facility. If the facility changes, a notification is sent to listeners once and the database is updated once- Parameters:
name
- The name of the facilitylocation
- The location of the facilityaddress
- The address of the facilitydescription
- The description of the facilityimage
- The new imageonComplete
- called once update is complete with weather the update was successful. Not called if properties are invalid- Returns:
- If the facility changed as a result
- See Also:
-
update
public Set<Integer> update(String name, com.google.firebase.firestore.GeoPoint location, String address, String description, Consumer<Boolean> onComplete) Validates an updates all properties of the facility. If the facility changes, a notification is sent to listeners once and the database is updated once- Parameters:
name
- The name of the facilitylocation
- The location of the facilityaddress
- The address of the facilitydescription
- The description of the facilityonComplete
- will always be true and will be called before return- Returns:
- If the facility changed as a result
- See Also:
-
subInstanceCascadeDeleteQuery
protected List<android.util.Pair<com.google.firebase.firestore.Query,Database.Collections>> subInstanceCascadeDeleteQuery()- Specified by:
subInstanceCascadeDeleteQuery
in classDatabaseInstance<Facility>
- Returns:
- A list of all querries that should be run whose instances will be deleted when this instance is deleted
-
NewInstance
@MustStir public static Set<Integer> NewInstance(Database db, String name, com.google.firebase.firestore.GeoPoint location, String address, String description, android.net.Uri image, @Dilutes String organizerID, Database.InitializationListener<Facility> listener) Creates a new Image instance in the database using the given data.- Parameters:
db
- The databasename
- The name of the facilitylocation
- The location of the facilityaddress
- The address of the locationdescription
- The description of the facilityimage
- The facility profile imageorganizerID
- The Id of the organizerlistener
- called once the instance is initialized. Not called if properties are invalid- Returns:
- The set property ids that are invalid
- See Also:
-