org.usergrid.persistence
Interface EntityManager

All Known Implementing Classes:
EntityManagerImpl

public interface EntityManager

The interface class for the data access object for Applications. Each application contains a set of users as well as a hierarchy of groups. A application also includes a set of message inboxes and a set of assets.


Method Summary
 void addGroupToRole(UUID userId, String roleName)
           
 void addMapToDictionary(EntityRef entityRef, String dictionaryName, Map<?,?> elementValues)
           
 void addSetToDictionary(EntityRef entityRef, String dictionaryName, Set<?> elementValues)
           
 Entity addToCollection(EntityRef entityRef, String collectionName, EntityRef itemRef)
          Adds an entity to the specified collection belonging to the specified entity entity.
 Entity addToCollections(List<EntityRef> ownerEntities, String collectionName, EntityRef itemRef)
           
 void addToDictionary(EntityRef entityRef, String dictionaryName, Object elementValue)
          Adds the specified value to the named entity list property.
 void addToDictionary(EntityRef entityRef, String dictionaryName, Object elementName, Object elementValue)
           
 void addUserToGroupRole(UUID userId, UUID groupId, String roleName)
           
 void addUserToRole(UUID userId, String roleName)
           
 boolean connectionExists(ConnectionRef connectionRef)
          Returns true if there is a connection between these entities, optionally matching the specified connection type and/or entity type.
 ConnectionRef connectionRef(EntityRef connectingEntity, ConnectedEntityRef... connections)
           
 ConnectionRef connectionRef(EntityRef connectingEntity, String connectionType, EntityRef connectedEntityRef)
           
 ConnectionRef connectionRef(EntityRef connectingEntity, String pairedConnectionType, EntityRef pairedEntity, String connectionType, EntityRef connectedEntityRef)
           
 void copyRelationships(EntityRef srcEntityRef, String srcRelationName, EntityRef dstEntityRef, String dstRelationName)
           
<A extends TypedEntity>
A
create(A entity)
           
<A extends Entity>
A
create(String entityType, Class<A> entityClass, Map<String,Object> properties)
           
 Entity create(String entityType, Map<String,Object> properties)
          Creates an entity of the specified type attached to the specified application.
 Entity create(UUID importId, String entityType, Map<String,Object> properties)
          Creates an entity of the specified type attached to the specified application.
 void createApplicationCollection(String entityType)
           
 ConnectionRef createConnection(ConnectionRef connection)
          Connect the specified entity to another entity with the specified connection type.
 ConnectionRef createConnection(EntityRef connectingEntity, ConnectedEntityRef... connections)
           
 ConnectionRef createConnection(EntityRef connectingEntity, String connectionType, EntityRef connectedEntityRef)
           
 ConnectionRef createConnection(EntityRef connectingEntity, String pairedConnectionType, EntityRef pairedEntity, String connectionType, EntityRef connectedEntityRef)
           
 Entity createGroupRole(UUID groupId, String roleName, long inactivity)
          Create a group role with the group id, roleName, and inactivity
 Entity createItemInCollection(EntityRef entityRef, String collectionName, String itemType, Map<String,Object> properties)
           
 Entity createRole(String roleName, String roleTitle, long inactivity)
          Create the role with the title and inactivity
 void delete(EntityRef entityRef)
          Deletes the specified entity.
 void deleteAlias(String aliasType, String alias)
           
 void deleteAlias(UUID ownerId, String aliasType, String alias)
           
 void deleteConnection(ConnectionRef connectionRef)
          Disconnects two connected entities with the specified connection type.
 void deleteGroupRole(UUID groupId, String roleName)
           
 void deleteProperty(EntityRef entityRef, String propertyName)
           
 void deleteRole(String roleName)
           
 Entity get(EntityRef entityRef)
          Retrieves the entity for the specified entity reference.
<A extends Entity>
A
get(EntityRef entityRef, Class<A> entityClass)
           
 Results get(List<UUID> entityIds, Class<? extends Entity> entityClass, Results.Level resultsLevel)
          Retrieves a set of Entitues cast to the specified class type.
 Results get(List<UUID> entityIds, Results.Level resultsLevel)
          Retrieves a set of Entities.
 Results get(List<UUID> entityIds, String entityType, Class<? extends Entity> entityClass, Results.Level resultsLevel)
          Retrieves a set of Entities cast to the specified class type.
 Entity get(UUID entityId)
           
<A extends Entity>
A
get(UUID entityId, Class<A> entityClass)
           
 Results getAggregateCounters(Query query)
           
 Results getAggregateCounters(UUID userId, UUID groupId, String category, String counterName, CounterResolution resolution, long start, long finish, boolean pad)
           
 Results getAggregateCounters(UUID userId, UUID groupId, UUID queueId, String category, String counterName, CounterResolution resolution, long start, long finish, boolean pad)
           
 Map<String,EntityRef> getAlias(String aliasType, List<String> aliases)
           
 EntityRef getAlias(String aliasType, String alias)
           
 Map<String,EntityRef> getAlias(UUID ownerId, String aliasType, List<String> aliases)
           
 EntityRef getAlias(UUID ownerId, String aliasType, String alias)
           
 Application getApplication()
           
 Map<String,Object> getApplicationCollectionMetadata()
           
 Set<String> getApplicationCollections()
          Get all collections for the application.
 long getApplicationCollectionSize(String collectionName)
           
 Map<String,Long> getApplicationCounters()
           
 EntityRef getApplicationRef()
           
 Map<String,Object> getAssociatedProperties(AssociatedEntityRef associatedEntityRef)
          Gets the connection properties for this entity.
 Object getAssociatedProperty(AssociatedEntityRef associatedEntityRef, String propertyName)
          Gets the value for a named connection property.
 Results getCollection(EntityRef entityRef, String collectionName, UUID startResult, int count, Results.Level resultsLevel, boolean reversed)
          Gets a list of entities in the specified collection belonging to the specified entity.
 Results getCollection(UUID entityId, String collectionName, Query query, Results.Level resultsLevel)
           
 Set<String> getCollectionIndexes(EntityRef entity, String collectionName)
           
 Set<String> getCollections(EntityRef entityRef)
          Gets the collections for the specified entity.
 Results getConnectedEntities(UUID entityId, String connectionType, String connectedEntityType, Results.Level resultsLevel)
          Gets the entities of the specified type connected to the specified entity, optionally matching the specified connection types and/or entity types.
 Results getConnectingEntities(UUID entityId, String connectionType, String connectedEntityType, Results.Level resultsLevel)
          Gets the entities connecting to this entity, optionally with the specified connection type and/or entity type.
 Set<String> getConnectionIndexes(EntityRef entity, String connectionType)
           
 List<ConnectedEntityRef> getConnections(UUID entityId, Query query)
           
 Set<String> getConnectionTypes(EntityRef ref)
           
 Set<String> getConnectionTypes(EntityRef ref, boolean filterConnection)
           
 Set<String> getConnectionTypes(UUID entityId, UUID connectedEntityId)
          Gets the types of connections between two entities.
 Set<String> getCounterNames()
           
 Set<String> getDictionaries(EntityRef entity)
           
 Map<Object,Object> getDictionaryAsMap(EntityRef entityRef, String dictionaryName)
           
 Set<Object> getDictionaryAsSet(EntityRef entityRef, String dictionaryName)
          Gets the values from an entity list property.
 Object getDictionaryElementValue(EntityRef entityRef, String dictionaryName, String elementName)
           
 Map<String,Long> getEntityCounters(UUID entityId)
           
 GeoIndexManager getGeoIndexManager()
           
 EntityRef getGroupByIdentifier(Identifier identifier)
           
 Set<String> getGroupPermissions(UUID groupId)
           
 Set<String> getGroupRolePermissions(UUID groupId, String roleName)
           
 Map<String,String> getGroupRoles(UUID groupId)
           
 Map<String,Role> getGroupRolesWithTitles(UUID userId)
           
 Map<String,Map<UUID,Set<String>>> getOwners(EntityRef entityRef)
          Gets the entities and collections that the specified entity is a member of.
 Map<String,Object> getProperties(EntityRef entityRef)
          Gets the properties for the specified entity property.
 Object getProperty(EntityRef entityRef, String propertyName)
          Gets the value for a named entity property.
 EntityRef getRef(UUID entityId)
           
 RelationManager getRelationManager(EntityRef entityRef)
           
 Set<String> getRolePermissions(String roleName)
           
 Map<String,String> getRoles()
           
 Map<String,Role> getRolesWithTitles(Set<String> roleNames)
           
 String getRoleTitle(String roleName)
           
 String getType(UUID entityId)
           
 EntityRef getUserByIdentifier(Identifier identifier)
           
 Map<String,String> getUserGroupRoles(UUID userId, UUID groupId)
           
 Set<String> getUserPermissions(UUID userId)
           
 Set<String> getUserRoles(UUID userId)
           
 Map<String,Role> getUserRolesWithTitles(UUID userId)
           
 Results getUsersInGroupRole(UUID groupId, String roleName, Results.Level level)
           
 void grantGroupPermission(UUID groupId, String permission)
           
 void grantGroupRolePermission(UUID groupId, String roleName, String permission)
           
 void grantRolePermission(String roleName, String permission)
           
 void grantRolePermissions(String roleName, Collection<String> permissions)
           
 void grantUserPermission(UUID userId, String permission)
           
 void incrementAggregateCounters(UUID userId, UUID groupId, String category, Map<String,Long> counters)
           
 void incrementAggregateCounters(UUID userId, UUID groupId, String category, String counterName, long value)
           
 boolean isPropertyValueUniqueForEntity(String entityType, String propertyName, Object propertyValue)
           
 void removeFromCollection(EntityRef entityRef, String collectionName, EntityRef itemRef)
          Removes an entity to the specified collection belonging to the specified entity.
 void removeFromDictionary(EntityRef entityRef, String dictionaryName, Object elementValue)
          Removes the specified value to the named entity list property.
 void removeGroupFromRole(UUID userId, String roleName)
           
 void removeUserFromGroupRole(UUID userId, UUID groupId, String roleName)
           
 void removeUserFromRole(UUID userId, String roleName)
           
 void resetRoles()
           
 void revokeGroupPermission(UUID groupId, String permission)
           
 void revokeGroupRolePermission(UUID groupId, String roleName, String permission)
           
 void revokeRolePermission(String roleName, String permission)
           
 void revokeUserPermission(UUID userId, String permission)
           
 Results searchCollection(EntityRef entityRef, String collectionName, Query query)
           
 Results searchConnectedEntities(EntityRef connectingEntity, Query query)
           
 List<ConnectionRef> searchConnections(EntityRef connectingEntity, Query query)
           
 void setApplicationId(UUID applicationId)
           
 void setAssociatedProperty(AssociatedEntityRef associatedEntityRef, String propertyName, Object propertyValue)
          Sets the value for a named connection property.
 void setProperty(EntityRef entityRef, String propertyName, Object propertyValue)
          Sets the value for a named entity property.
 void setProperty(EntityRef entityRef, String propertyName, Object propertyValue, boolean override)
          You should only use this method if you are absolutely sure what you're doing.
 void update(Entity entity)
          Updates the entity with the properties and values in the Entity Object.
 void updateApplication(Application app)
           
 void updateApplication(Map<String,Object> properties)
           
 void updateProperties(EntityRef entityRef, Map<String,Object> properties)
          Updates the properties for the specified entity.
 EntityRef validate(EntityRef entityRef)
          Validates that the entity exists in the datastore meaning that it exists and the type has been loaded if not already provided.
 

Method Detail

setApplicationId

void setApplicationId(UUID applicationId)

getGeoIndexManager

GeoIndexManager getGeoIndexManager()

getApplicationRef

EntityRef getApplicationRef()

getApplication

Application getApplication()
                           throws Exception
Throws:
Exception

updateApplication

void updateApplication(Application app)
                       throws Exception
Throws:
Exception

updateApplication

void updateApplication(Map<String,Object> properties)
                       throws Exception
Throws:
Exception

getRelationManager

RelationManager getRelationManager(EntityRef entityRef)

getApplicationCollections

Set<String> getApplicationCollections()
                                      throws Exception
Get all collections for the application. Includes both user defined collections and schema collections

Returns:
Throws:
Exception

getApplicationCollectionMetadata

Map<String,Object> getApplicationCollectionMetadata()
                                                    throws Exception
Throws:
Exception

getApplicationCollectionSize

long getApplicationCollectionSize(String collectionName)
                                  throws Exception
Throws:
Exception

create

Entity create(String entityType,
              Map<String,Object> properties)
              throws Exception
Creates an entity of the specified type attached to the specified application.

Parameters:
type - the type of the entity to create.
properties - property values to create in the new entity or null.
Returns:
the newly created entity object.
Throws:
Exception

create

<A extends Entity> A create(String entityType,
                            Class<A> entityClass,
                            Map<String,Object> properties)
                        throws Exception
Throws:
Exception

create

<A extends TypedEntity> A create(A entity)
                             throws Exception
Throws:
Exception

create

Entity create(UUID importId,
              String entityType,
              Map<String,Object> properties)
              throws Exception
Creates an entity of the specified type attached to the specified application.

Parameters:
importId - the UUID to assign to the imported entity
type - the type of the entity to create.
properties - property values to create in the new entity or null.
Returns:
the newly created entity object.
Throws:
Exception - the exception

createApplicationCollection

void createApplicationCollection(String entityType)
                                 throws Exception
Throws:
Exception

deleteAlias

void deleteAlias(String aliasType,
                 String alias)
                 throws Exception
Throws:
Exception

deleteAlias

void deleteAlias(UUID ownerId,
                 String aliasType,
                 String alias)
                 throws Exception
Throws:
Exception

getAlias

EntityRef getAlias(String aliasType,
                   String alias)
                   throws Exception
Throws:
Exception

getAlias

EntityRef getAlias(UUID ownerId,
                   String aliasType,
                   String alias)
                   throws Exception
Throws:
Exception

getAlias

Map<String,EntityRef> getAlias(String aliasType,
                               List<String> aliases)
                               throws Exception
Throws:
Exception

getAlias

Map<String,EntityRef> getAlias(UUID ownerId,
                               String aliasType,
                               List<String> aliases)
                               throws Exception
Throws:
Exception

validate

EntityRef validate(EntityRef entityRef)
                   throws Exception
Validates that the entity exists in the datastore meaning that it exists and the type has been loaded if not already provided.

Parameters:
EntityRef -
Returns:
an validated EntityRef or null.
Throws:
Exception

getType

String getType(UUID entityId)
               throws Exception
Throws:
Exception

getRef

EntityRef getRef(UUID entityId)
                 throws Exception
Throws:
Exception

get

Entity get(UUID entityId)
           throws Exception
Throws:
Exception

get

Entity get(EntityRef entityRef)
           throws Exception
Retrieves the entity for the specified entity reference.

Parameters:
entity - an Entity reference
Returns:
an Entity object for the specified entity reference.
Throws:
Exception

get

<A extends Entity> A get(UUID entityId,
                         Class<A> entityClass)
                     throws Exception
Throws:
Exception

get

Results get(List<UUID> entityIds,
            Results.Level resultsLevel)
            throws Exception
Retrieves a set of Entities. Will return an Entity object containing all of the entity's name/value properties and properties. For large numbers of entities, retrieving the properties can have additional overhead, passing false for includeProperties can result in better performance.

This method will be deprecated in future releases in favor of a version that supports paging.

Parameters:
entityIds - a list of entity UUIDs.
includeProperties - whether to retrieve properties for the specified entities.
Returns:
a list of entity objects.
Throws:
Exception

get

Results get(List<UUID> entityIds,
            Class<? extends Entity> entityClass,
            Results.Level resultsLevel)
            throws Exception
Retrieves a set of Entitues cast to the specified class type.

Type Parameters:
A -
Parameters:
entityIds -
includeProperties -
entityClass -
Returns:
a list of entity objects.
Throws:
Exception

get

Results get(List<UUID> entityIds,
            String entityType,
            Class<? extends Entity> entityClass,
            Results.Level resultsLevel)
            throws Exception
Retrieves a set of Entities cast to the specified class type.

Type Parameters:
A -
Parameters:
entityIds -
includeProperties -
entityType -
entityClass -
Returns:
a list of entity objects.
Throws:
Exception

update

void update(Entity entity)
            throws Exception
Updates the entity with the properties and values in the Entity Object.

Parameters:
entity - an Entity object.
Throws:
Exception

getProperty

Object getProperty(EntityRef entityRef,
                   String propertyName)
                   throws Exception
Gets the value for a named entity property. Entity properties must be defined in the schema

Parameters:
entity - an entity reference
propertyName - the property name to retrieve.
Returns:
the value of the named property or null.
Throws:
Exception - the exception

getProperties

Map<String,Object> getProperties(EntityRef entityRef)
                                 throws Exception
Gets the properties for the specified entity property.

Parameters:
entity - an entity reference
Returns:
the property values.
Throws:
Exception - the exception

setProperty

void setProperty(EntityRef entityRef,
                 String propertyName,
                 Object propertyValue)
                 throws Exception
Sets the value for a named entity property. If the property is being index, the index is updated to remove the old value and add the new value.

Parameters:
entity - an entity reference
propertyName - the property to set.
propertyValue - new value for property.
Throws:
Exception - the exception

setProperty

void setProperty(EntityRef entityRef,
                 String propertyName,
                 Object propertyValue,
                 boolean override)
                 throws Exception
You should only use this method if you are absolutely sure what you're doing. Use setProperty without the override param in most cases. With great power comes great responsibility....

Parameters:
entityRef -
propertyName -
propertyValue -
override - set to true to force this value to persist. This will ignore all mutable attributes as well as validation. Use with care
Throws:
Exception

updateProperties

void updateProperties(EntityRef entityRef,
                      Map<String,Object> properties)
                      throws Exception
Updates the properties for the specified entity.

Parameters:
entity - an entity reference
properties - the properties
Throws:
Exception - the exception

deleteProperty

void deleteProperty(EntityRef entityRef,
                    String propertyName)
                    throws Exception
Throws:
Exception

getDictionaryAsSet

Set<Object> getDictionaryAsSet(EntityRef entityRef,
                               String dictionaryName)
                               throws Exception
Gets the values from an entity list property. Lists are a special type of entity property that can contain an unordered set of non-duplicate values.

Parameters:
entity - an entity reference
dictionaryName - the property list name to retrieve.
Returns:
the value of the named property or null.
Throws:
Exception - the exception

addToDictionary

void addToDictionary(EntityRef entityRef,
                     String dictionaryName,
                     Object elementValue)
                     throws Exception
Adds the specified value to the named entity list property. Lists are a special type of entity property that can contain an unordered set of non-duplicate values.

Parameters:
entity - an entity reference
dictionaryName - the property to set.
elementValue - new value for property.
Throws:
Exception - the exception

addToDictionary

void addToDictionary(EntityRef entityRef,
                     String dictionaryName,
                     Object elementName,
                     Object elementValue)
                     throws Exception
Throws:
Exception

addSetToDictionary

void addSetToDictionary(EntityRef entityRef,
                        String dictionaryName,
                        Set<?> elementValues)
                        throws Exception
Throws:
Exception

addMapToDictionary

void addMapToDictionary(EntityRef entityRef,
                        String dictionaryName,
                        Map<?,?> elementValues)
                        throws Exception
Throws:
Exception

getDictionaryAsMap

Map<Object,Object> getDictionaryAsMap(EntityRef entityRef,
                                      String dictionaryName)
                                      throws Exception
Throws:
Exception

getDictionaryElementValue

Object getDictionaryElementValue(EntityRef entityRef,
                                 String dictionaryName,
                                 String elementName)
                                 throws Exception
Throws:
Exception

removeFromDictionary

void removeFromDictionary(EntityRef entityRef,
                          String dictionaryName,
                          Object elementValue)
                          throws Exception
Removes the specified value to the named entity list property. Lists are a special type of entity property that can contain an unordered set of non-duplicate values.

Parameters:
entity - an entity reference
dictionaryName - the property to set.
elementValue - new value for property.
Throws:
Exception - the exception

getDictionaries

Set<String> getDictionaries(EntityRef entity)
                            throws Exception
Throws:
Exception

delete

void delete(EntityRef entityRef)
            throws Exception
Deletes the specified entity.

Parameters:
entity - an entity reference
Throws:
Exception - the exception

getOwners

Map<String,Map<UUID,Set<String>>> getOwners(EntityRef entityRef)
                                            throws Exception
Gets the entities and collections that the specified entity is a member of.

Parameters:
entity - an entity reference
Returns:
a map of entity references to set of collection names for the entities and collections that this entity is a member of.
Throws:
Exception - the exception

getCollections

Set<String> getCollections(EntityRef entityRef)
                           throws Exception
Gets the collections for the specified entity. Collection for a given type are encoded in the schema, this method loads the entity type and returns the collections from the schema.

Parameters:
entity - an entity reference
Returns:
the collections for the entity type of the given entity.
Throws:
Exception - the exception

getCollection

Results getCollection(EntityRef entityRef,
                      String collectionName,
                      UUID startResult,
                      int count,
                      Results.Level resultsLevel,
                      boolean reversed)
                      throws Exception
Gets a list of entities in the specified collection belonging to the specified entity.

Parameters:
entity - an entity reference
collectionName - the collection name.
startResult - the start result
count - the count
Returns:
a list of entities in the specified collection.
Throws:
Exception - the exception

getCollection

Results getCollection(UUID entityId,
                      String collectionName,
                      Query query,
                      Results.Level resultsLevel)
                      throws Exception
Throws:
Exception

addToCollection

Entity addToCollection(EntityRef entityRef,
                       String collectionName,
                       EntityRef itemRef)
                       throws Exception
Adds an entity to the specified collection belonging to the specified entity entity.

Parameters:
entity - an entity reference
collectionName - the collection name.
item - an entity to be added to the collection.
Throws:
Exception - the exception

addToCollections

Entity addToCollections(List<EntityRef> ownerEntities,
                        String collectionName,
                        EntityRef itemRef)
                        throws Exception
Throws:
Exception

createItemInCollection

Entity createItemInCollection(EntityRef entityRef,
                              String collectionName,
                              String itemType,
                              Map<String,Object> properties)
                              throws Exception
Throws:
Exception

removeFromCollection

void removeFromCollection(EntityRef entityRef,
                          String collectionName,
                          EntityRef itemRef)
                          throws Exception
Removes an entity to the specified collection belonging to the specified entity.

Parameters:
entity - an entity reference
collectionName - the collection name.
item - a entity to be removed from the collection.
Throws:
Exception - the exception

searchCollection

Results searchCollection(EntityRef entityRef,
                         String collectionName,
                         Query query)
                         throws Exception
Throws:
Exception

getCollectionIndexes

Set<String> getCollectionIndexes(EntityRef entity,
                                 String collectionName)
                                 throws Exception
Throws:
Exception

copyRelationships

void copyRelationships(EntityRef srcEntityRef,
                       String srcRelationName,
                       EntityRef dstEntityRef,
                       String dstRelationName)
                       throws Exception
Throws:
Exception

createConnection

ConnectionRef createConnection(ConnectionRef connection)
                               throws Exception
Connect the specified entity to another entity with the specified connection type. Connections are directional relationships that can be traversed in either direction.

Parameters:
entity - an entity reference
connectionType - type of connection to make.
connectedEntity - the entity to connect.
Throws:
Exception - the exception

createConnection

ConnectionRef createConnection(EntityRef connectingEntity,
                               String connectionType,
                               EntityRef connectedEntityRef)
                               throws Exception
Throws:
Exception

createConnection

ConnectionRef createConnection(EntityRef connectingEntity,
                               String pairedConnectionType,
                               EntityRef pairedEntity,
                               String connectionType,
                               EntityRef connectedEntityRef)
                               throws Exception
Throws:
Exception

createConnection

ConnectionRef createConnection(EntityRef connectingEntity,
                               ConnectedEntityRef... connections)
                               throws Exception
Throws:
Exception

connectionRef

ConnectionRef connectionRef(EntityRef connectingEntity,
                            String connectionType,
                            EntityRef connectedEntityRef)
                            throws Exception
Throws:
Exception

connectionRef

ConnectionRef connectionRef(EntityRef connectingEntity,
                            String pairedConnectionType,
                            EntityRef pairedEntity,
                            String connectionType,
                            EntityRef connectedEntityRef)
                            throws Exception
Throws:
Exception

connectionRef

ConnectionRef connectionRef(EntityRef connectingEntity,
                            ConnectedEntityRef... connections)

deleteConnection

void deleteConnection(ConnectionRef connectionRef)
                      throws Exception
Disconnects two connected entities with the specified connection type. Connections are directional relationships that can be traversed in either direction.

Parameters:
entity - an entity reference
connectionType - type of connection to make.
connectedEntity - the entity to connect
Throws:
Exception - the exception

connectionExists

boolean connectionExists(ConnectionRef connectionRef)
                         throws Exception
Returns true if there is a connection between these entities, optionally matching the specified connection type and/or entity type.

Parameters:
entity - an entity reference
connectionType - type of connection or null.
connectedEntity - an entity reference for the connected entit.
Returns:
a list of entities connecting to this one.
Throws:
Exception - the exception

getConnectionTypes

Set<String> getConnectionTypes(UUID entityId,
                               UUID connectedEntityId)
                               throws Exception
Gets the types of connections between two entities.

Parameters:
entity - an entity reference
connectedEntity - a connected.
Returns:
a set of the connection types between the two entities.
Throws:
Exception - the exception

getConnectionTypes

Set<String> getConnectionTypes(EntityRef ref)
                               throws Exception
Throws:
Exception

getConnectionTypes

Set<String> getConnectionTypes(EntityRef ref,
                               boolean filterConnection)
                               throws Exception
Throws:
Exception

getConnectedEntities

Results getConnectedEntities(UUID entityId,
                             String connectionType,
                             String connectedEntityType,
                             Results.Level resultsLevel)
                             throws Exception
Gets the entities of the specified type connected to the specified entity, optionally matching the specified connection types and/or entity types. Returns a list of entity ids.

Parameters:
entity - an entity reference
connectionType - type of connection or null.
connectedEntityType - type of entity or null.
Returns:
a list of connected entity ids.
Throws:
Exception - the exception

getConnectingEntities

Results getConnectingEntities(UUID entityId,
                              String connectionType,
                              String connectedEntityType,
                              Results.Level resultsLevel)
                              throws Exception
Gets the entities connecting to this entity, optionally with the specified connection type and/or entity type.

e.g. "get users who have favorited this place"

Parameters:
entity - an entity reference
connectionType - type of connection or null.
connectingEntityType - type of entity or null.
Returns:
a list of entities connecting to this one.
Throws:
Exception - the exception

getConnections

List<ConnectedEntityRef> getConnections(UUID entityId,
                                        Query query)
                                        throws Exception
Throws:
Exception

searchConnectedEntities

Results searchConnectedEntities(EntityRef connectingEntity,
                                Query query)
                                throws Exception
Throws:
Exception

getAssociatedProperty

Object getAssociatedProperty(AssociatedEntityRef associatedEntityRef,
                             String propertyName)
                             throws Exception
Gets the value for a named connection property. Connection properties are properties associated with a connection.

Parameters:
connectionType - the connection type.
connectedEntityId - a unique entity UUID.
propertyName - the property name to retrieve.
Returns:
the value of the named property or null.
Throws:
Exception - the exception

getAssociatedProperties

Map<String,Object> getAssociatedProperties(AssociatedEntityRef associatedEntityRef)
                                           throws Exception
Gets the connection properties for this entity.

Parameters:
connectionType - the connection type.
connectedEntityId - a unique entity UUID.
Returns:
the property values.
Throws:
Exception - the exception

setAssociatedProperty

void setAssociatedProperty(AssociatedEntityRef associatedEntityRef,
                           String propertyName,
                           Object propertyValue)
                           throws Exception
Sets the value for a named connection property. If the property is being index, the index is updated to remove the old value and add the new value.

Parameters:
connectionType - the connection type.
connectedEntityId - a unique entity UUID.
propertyName - the property to set.
propertyValue - new value for property.
Throws:
Exception - the exception

searchConnections

List<ConnectionRef> searchConnections(EntityRef connectingEntity,
                                      Query query)
                                      throws Exception
Throws:
Exception

getConnectionIndexes

Set<String> getConnectionIndexes(EntityRef entity,
                                 String connectionType)
                                 throws Exception
Throws:
Exception

getRoles

Map<String,String> getRoles()
                            throws Exception
Throws:
Exception

resetRoles

void resetRoles()
                throws Exception
Throws:
Exception

createRole

Entity createRole(String roleName,
                  String roleTitle,
                  long inactivity)
                  throws Exception
Create the role with the title and inactivity

Parameters:
roleName - The name of the role
roleTitle - The human readable title
inactivity - The amount of inactivity time to have the role expire. 0 is infinity, I.E no expiration
Returns:
Throws:
Exception

grantRolePermission

void grantRolePermission(String roleName,
                         String permission)
                         throws Exception
Throws:
Exception

grantRolePermissions

void grantRolePermissions(String roleName,
                          Collection<String> permissions)
                          throws Exception
Throws:
Exception

revokeRolePermission

void revokeRolePermission(String roleName,
                          String permission)
                          throws Exception
Throws:
Exception

getRolePermissions

Set<String> getRolePermissions(String roleName)
                               throws Exception
Throws:
Exception

deleteRole

void deleteRole(String roleName)
                throws Exception
Throws:
Exception

getGroupRoles

Map<String,String> getGroupRoles(UUID groupId)
                                 throws Exception
Throws:
Exception

createGroupRole

Entity createGroupRole(UUID groupId,
                       String roleName,
                       long inactivity)
                       throws Exception
Create a group role with the group id, roleName, and inactivity

Parameters:
groupId -
roleName -
inactivity -
Returns:
Throws:
Exception

grantGroupRolePermission

void grantGroupRolePermission(UUID groupId,
                              String roleName,
                              String permission)
                              throws Exception
Throws:
Exception

revokeGroupRolePermission

void revokeGroupRolePermission(UUID groupId,
                               String roleName,
                               String permission)
                               throws Exception
Throws:
Exception

getGroupRolePermissions

Set<String> getGroupRolePermissions(UUID groupId,
                                    String roleName)
                                    throws Exception
Throws:
Exception

deleteGroupRole

void deleteGroupRole(UUID groupId,
                     String roleName)
                     throws Exception
Throws:
Exception

getUserRoles

Set<String> getUserRoles(UUID userId)
                         throws Exception
Throws:
Exception

addUserToRole

void addUserToRole(UUID userId,
                   String roleName)
                   throws Exception
Throws:
Exception

removeUserFromRole

void removeUserFromRole(UUID userId,
                        String roleName)
                        throws Exception
Throws:
Exception

getUserPermissions

Set<String> getUserPermissions(UUID userId)
                               throws Exception
Throws:
Exception

grantUserPermission

void grantUserPermission(UUID userId,
                         String permission)
                         throws Exception
Throws:
Exception

revokeUserPermission

void revokeUserPermission(UUID userId,
                          String permission)
                          throws Exception
Throws:
Exception

getUserGroupRoles

Map<String,String> getUserGroupRoles(UUID userId,
                                     UUID groupId)
                                     throws Exception
Throws:
Exception

addUserToGroupRole

void addUserToGroupRole(UUID userId,
                        UUID groupId,
                        String roleName)
                        throws Exception
Throws:
Exception

removeUserFromGroupRole

void removeUserFromGroupRole(UUID userId,
                             UUID groupId,
                             String roleName)
                             throws Exception
Throws:
Exception

getUsersInGroupRole

Results getUsersInGroupRole(UUID groupId,
                            String roleName,
                            Results.Level level)
                            throws Exception
Throws:
Exception

incrementAggregateCounters

void incrementAggregateCounters(UUID userId,
                                UUID groupId,
                                String category,
                                String counterName,
                                long value)

getAggregateCounters

Results getAggregateCounters(UUID userId,
                             UUID groupId,
                             String category,
                             String counterName,
                             CounterResolution resolution,
                             long start,
                             long finish,
                             boolean pad)

getAggregateCounters

Results getAggregateCounters(UUID userId,
                             UUID groupId,
                             UUID queueId,
                             String category,
                             String counterName,
                             CounterResolution resolution,
                             long start,
                             long finish,
                             boolean pad)

getAggregateCounters

Results getAggregateCounters(Query query)
                             throws Exception
Throws:
Exception

getUserByIdentifier

EntityRef getUserByIdentifier(Identifier identifier)
                              throws Exception
Throws:
Exception

getGroupByIdentifier

EntityRef getGroupByIdentifier(Identifier identifier)
                               throws Exception
Throws:
Exception

getCounterNames

Set<String> getCounterNames()
                            throws Exception
Throws:
Exception

getEntityCounters

Map<String,Long> getEntityCounters(UUID entityId)
                                   throws Exception
Throws:
Exception

getApplicationCounters

Map<String,Long> getApplicationCounters()
                                        throws Exception
Throws:
Exception

incrementAggregateCounters

void incrementAggregateCounters(UUID userId,
                                UUID groupId,
                                String category,
                                Map<String,Long> counters)

isPropertyValueUniqueForEntity

boolean isPropertyValueUniqueForEntity(String entityType,
                                       String propertyName,
                                       Object propertyValue)
                                       throws Exception
Throws:
Exception

get

<A extends Entity> A get(EntityRef entityRef,
                         Class<A> entityClass)
                     throws Exception
Throws:
Exception

getRolesWithTitles

Map<String,Role> getRolesWithTitles(Set<String> roleNames)
                                    throws Exception
Throws:
Exception

getRoleTitle

String getRoleTitle(String roleName)
                    throws Exception
Throws:
Exception

getUserRolesWithTitles

Map<String,Role> getUserRolesWithTitles(UUID userId)
                                        throws Exception
Throws:
Exception

getGroupRolesWithTitles

Map<String,Role> getGroupRolesWithTitles(UUID userId)
                                         throws Exception
Throws:
Exception

addGroupToRole

void addGroupToRole(UUID userId,
                    String roleName)
                    throws Exception
Throws:
Exception

removeGroupFromRole

void removeGroupFromRole(UUID userId,
                         String roleName)
                         throws Exception
Throws:
Exception

getGroupPermissions

Set<String> getGroupPermissions(UUID groupId)
                                throws Exception
Throws:
Exception

grantGroupPermission

void grantGroupPermission(UUID groupId,
                          String permission)
                          throws Exception
Throws:
Exception

revokeGroupPermission

void revokeGroupPermission(UUID groupId,
                           String permission)
                           throws Exception
Throws:
Exception


Copyright © 2013. All Rights Reserved.