Interface ILocationService


public interface ILocationService

Provides location (geo-position and address) information for a user or task

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).findLatest();
 if (location != null)
 {
   ivy.log.info("Last known position of user "+ivy.session.getSessionUserName()+" was "+location.getPosition());
 }
See Also:
API:
This is a public API.
  • Method Details

    • add

      ILocation add(LocationBuilder locationBuilder)

      Adds a new location.

      Example:

       import ch.ivyteam.ivy.location.GeoPosition;
       GeoPosition ivyTeamOffice = GeoPosition.inDegrees(47.171573, 8.516835);
       ivy.session.getSessionUser().locations().add(ILocation.create(ivyTeamOffice).withNote("My work place"));
       

      Parameters:
      locationBuilder - a builder that specifies the location to add
      Returns:
      location
      See Also:
      API:
      This public API is available in IvyScript and Java. It has the visibility EXPERT.
    • search

      LocationQuery search()

      Search for locations.

      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();
       
      Returns:
      location query
      API:
      This public API is available in IvyScript and Java. It has the visibility EXPERT.
    • delete

      void delete(ILocation location)

      Deletes the given location.

      Does nothing if the given location does not exist.

      Example:

       import ch.ivyteam.ivy.location.ILocation.Type;
       import ch.ivyteam.ivy.location.ILocation;
       ILocation location = ivy.session.getSessionUser().locations().search().type(Type.USER_POSITION).findFirst();
       ivy.session.getSessionUser().locations().delete(location);
       
      Parameters:
      location - location to delete
      Throws:
      IllegalArgumentException - if the given location does not belong to this location service
      See Also:
      API:
      This public API is available in IvyScript and Java. It has the visibility EXPERT.
    • deleteAllThatMatch

      void deleteAllThatMatch(LocationQuery query)

      Deletes all locations that match the given query

      Example:

       import ch.ivyteam.ivy.location.ILocation.Type;
       import ch.ivyteam.ivy.location.ILocation;
       import ch.ivyteam.ivy.location.LocationQuery;
       LocationQuery query = ivy.session.getSessionUser().locations().search().type(Type.USER_POSITION);
       ivy.session.getSessionUser().locations().deleteAllThatMatch(query);
       
      Parameters:
      query - location query. See method search().
      Throws:
      IllegalArgumentException - if any of the matching location does not belong to this location service
      See Also:
      API:
      This public API is available in IvyScript and Java. It has the visibility EXPERT.