Class LocationQuery

java.lang.Object
ch.ivyteam.ivy.location.LocationQuery

public abstract class LocationQuery extends Object

Query to search locations.

Use % as placeholder to match any string. E.g. Baar% will match Baar but also Baarerstrasse.

Example:

 import ch.ivyteam.ivy.location.ILocation;
 import ch.ivyteam.ivy.location.ILocation.Type;
 ILocation location = ivy.session.getSessionUser().locations().search().type(Type.USER_POSITION).orderBy().timestamp().descending().findFirst();
 if (location != null)
 {
   ivy.log.info("Last known position of user "+ivy.session.getSessionUserName()+" was "+location.getPosition());
 }
API:
This is a public API.
  • Method Details

    • type

      public LocationQuery type(String type)

      Filters the search result for locations with the given type.

      Use % as placeholder to match any string

      Example:

       import ch.ivyteam.ivy.location.ILocation;
       import ch.ivyteam.ivy.location.ILocation.Type;
       List<ILocation> locations = ivy.session.getSessionUser().locations().search().type(Type.USER_POSITION).findAll();
       
      Parameters:
      type - the type to search for. May contain % as placeholder
      Returns:
      query
      See Also:
      API:
      This public API is available in Java.
    • name

      public LocationQuery name(String name)

      Filters the search result for locations with the given name.

      Use % as placeholder to match any string

      Example:

       import ch.ivyteam.ivy.location.ILocation;
       List<ILocation> locations = ivy.session.getSessionUser().locations().search().name("%Church%").findAll();
       
      Parameters:
      name - the name to search for. May contain % as placeholder
      Returns:
      query
      See Also:
      API:
      This public API is available in Java.
    • address

      public LocationQuery address(String address)

      Filters the search result for locations with the given address.

      Use % as placeholder to match any string

      Example:

       import ch.ivyteam.ivy.location.ILocation;
       List<ILocation> locations = ivy.session.getSessionUser().locations().search().address("%Zug%").findAll();
       
      Parameters:
      address - the address to search for. May contain % as placeholder
      Returns:
      query
      See Also:
      API:
      This public API is available in Java.
    • note

      public LocationQuery note(String note)

      Filters the search result for locations with the given note.

      Use % as placeholder to match any string

      Example:

       import ch.ivyteam.ivy.location.ILocation;
       List<ILocation> locations = ivy.session.getSessionUser().locations().search().note("%Mobile App%").findAll();
       
      Parameters:
      note - the note to search for. May contain % as placeholder
      Returns:
      query
      See Also:
      API:
      This public API is available in Java.
    • nearby

      public LocationQuery nearby(GeoPosition position, Distance distance)

      Filters the search result for locations that are within the given distance to the given position.

      Example:

       import ch.ivyteam.ivy.location.ILocation;
       import ch.ivyteam.ivy.location.GeoPosition;
       import ch.ivyteam.ivy.location.Distance;
      
       GeoPosition ivyTeamOffice = GeoPosition.inDegrees(47.171573, 8.516835);
       Distance walkDistance = Distance.inMeters(500.0);
      
       List<ILocation> restaurants = ivy.session.getSessionUser().locations().search().nearby(ivyTeamOffice, walkDistance).findAll();
       
      Parameters:
      position - the position the locations to search for must be near by.
      distance - the maximum distance the locations to search for must be away from the given position.
      Returns:
      query
      See Also:
      API:
      This public API is available in Java.
    • orderBy

      public LocationQuery.LocationOrder orderBy()

      Orders the results of the query.

      Example:

       import ch.ivyteam.ivy.location.ILocation;
       ILocation latestLocation = ivy.session.getSessionUser().locations().search().orderBy().timestamp().descending().findFirst();
       
      Returns:
      order
      API:
      This public API is available in Java.
    • findFirst

      public ILocation findFirst()

      Finds a location that matches the filter criteria and is at top position in the order specified with orderBy().

      Example:

       import ch.ivyteam.ivy.location.ILocation;
       ILocation ivyTeamHQ = ivy.session.getSessionUser().locations().search().name("ivyTeam Headquarter").findFirst();
       
      Returns:
      first location that matches the filter criteria in the specified order. Null if no location matches the filter.
      See Also:
      API:
      This public API is available in Java.
    • findLatest

      public ILocation findLatest()

      Finds a location that matches the filter criteria and is the latest location available.

      ivy.session.getSessionUser.locations().search().findLatest() is the same as
      ivy.session.getSessionUser().locations().search().orderBy().timestamp().descending().findFirst()

      Example:

       import ch.ivyteam.ivy.location.ILocation;
       ILocation latestLocation = ivy.session.getSessionUser().locations().search().findLatest();
       
      Returns:
      latest location that matches the filter criteria. Null if no location matches the filter.
      See Also:
      API:
      This public API is available in Java.
    • findAll

      public List<ILocation> findAll()

      Finds all locations that match the filter criteria. The list is ordered as specified with orderBy().

      Example:

       import ch.ivyteam.ivy.location.ILocation;
       List<ILocation> allLocations = ivy.session.getSessionUser().locations().search().findAll();
       
      Returns:
      all locations that match the filter criteria in the specified order
      See Also:
      API:
      This public API is available in Java.