Class Facility

All Implemented Interfaces:
Database.Dissolvable, Database.UpdateListener

@Dissolves public class Facility extends DatabaseInstance<Facility>
An instance of a facility database item - A facility can be edited except for the organizer
  • Field Details

  • Constructor Details

  • Method Details

    • cast

      @Observes protected Facility cast()
      Description copied from class: DatabaseInstance
      Gets this instance casted to the generic type
      Specified by:
      cast in class DatabaseInstance<Facility>
      Returns:
      This as the generic type
    • getName

      public String getName()
    • setName

      public boolean setName(String val)
    • getLocation

      public com.google.firebase.firestore.GeoPoint getLocation()
    • setLocation

      public boolean setLocation(com.google.firebase.firestore.GeoPoint val)
    • getDescription

      public String getDescription()
    • setDescription

      public boolean setDescription(String val)
    • getAddress

      public String getAddress()
    • setAddress

      public boolean setAddress(String address)
    • 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

      public String 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 class DatabaseInstance<Facility>
    • getImageID

      public String getImageID()
    • getOrganizerID

      public String getOrganizerID()
    • getImage

      @Observes public Image 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 instance
      onComplete - called on completion with if the update was successful
      See Also:
    • getOrganizer

      @Observes public User 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 facility
      location - The location of the facility
      address - The address of the facility
      description - The description of the facility
      image - The new image
      onComplete - 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 facility
      location - The location of the facility
      address - The address of the facility
      description - The description of the facility
      onComplete - 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 class DatabaseInstance<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 database
      name - The name of the facility
      location - The location of the facility
      address - The address of the location
      description - The description of the facility
      image - The facility profile image
      organizerID - The Id of the organizer
      listener - called once the instance is initialized. Not called if properties are invalid
      Returns:
      The set property ids that are invalid
      See Also: