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:
ILocation
,GeoPosition
,Distance
- API:
- This is a public API.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ILocation
add(LocationBuilder locationBuilder)
Adds a new location.void
delete(ILocation location)
Deletes the given location.void
deleteAllThatMatch(LocationQuery query)
Deletes all locations that match the givenquery
LocationQuery
search()
Search for locations.
-
-
-
Method Detail
-
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:
ILocation.create(GeoPosition)
- 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:
deleteAllThatMatch(LocationQuery)
- 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 methodsearch()
.- Throws:
IllegalArgumentException
- if any of the matching location does not belong to this location service- See Also:
search()
,delete(ILocation)
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
-