org.usergrid.persistence.cassandra
Class EntityManagerImpl

java.lang.Object
  extended by org.usergrid.persistence.cassandra.EntityManagerImpl
All Implemented Interfaces:
EntityManager

public class EntityManagerImpl
extends Object
implements EntityManager

Cassandra-specific implementation of Datastore

Author:
edanuff

Field Summary
static String APPLICATION_COLLECTION
           
static String APPLICATION_ENTITIES
           
static me.prettyprint.cassandra.serializers.ByteBufferSerializer be
           
static me.prettyprint.cassandra.serializers.LongSerializer le
           
static long ONE_COUNT
           
static me.prettyprint.cassandra.serializers.StringSerializer se
           
static me.prettyprint.cassandra.serializers.UUIDSerializer ue
           
 
Constructor Summary
EntityManagerImpl()
           
 
Method Summary
 void addGroupToRole(UUID groupId, 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 elementValue, Object elementCoValue)
           
 void addUserToGroupRole(UUID userId, UUID groupId, String roleName)
           
 void addUserToRole(UUID userId, String roleName)
           
<A extends Entity>
A
batchCreate(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m, String entityType, Class<A> entityClass, Map<String,Object> properties, UUID importId, UUID timestampUuid)
           
 void batchCreateRole(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch, UUID groupId, String roleName, String roleTitle, long inactivity, RoleRef roleRef, UUID timestampUuid)
           
 me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batchSetProperty(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch, Entity entity, String propertyName, Object propertyValue, boolean force, boolean noRead, UUID timestampUuid)
           
 me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batchSetProperty(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch, Entity entity, String propertyName, Object propertyValue, UUID timestampUuid)
          Batch dictionary property.
 me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batchUpdateDictionary(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch, Entity entity, String dictionaryName, Object elementValue, boolean removeFromDictionary, UUID timestampUuid)
          Batch update set.
 me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batchUpdateDictionary(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch, Entity entity, String dictionaryName, Object elementValue, Object elementCoValue, boolean removeFromDictionary, UUID timestampUuid)
           
 me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batchUpdateProperties(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch, Entity entity, Map<String,Object> properties, UUID timestampUuid)
          Batch update properties.
 me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batchUpdateProperties(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch, UUID entityId, Map<String,Object> properties, UUID timestampUuid)
          Batch update properties.
 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)
           
<A extends Entity>
A
create(String entityType, Class<A> entityClass, Map<String,Object> properties, UUID importId)
          Creates a new entity.
 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.
 UUID createAlias(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> mutator, UUID ownerId, EntityRef ref, String aliasType, String alias, long timestamp)
           
 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 decrementEntityCollection(String collection_name)
           
 void decrementEntityCollection(String collection_name, long cassandraTimestamp)
           
 void delete(EntityRef entityRef)
          Deletes the specified entity.
 void deleteAlias(String aliasType, String alias)
           
 void deleteAlias(UUID ownerId, String aliasType, String alias)
           
 void deleteAliasesForEntity(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> mutator, UUID entityId, long timestamp)
           
 void deleteConnection(ConnectionRef connectionRef)
          Disconnects two connected entities with the specified connection type.
 void deleteEntity(UUID entityId)
           
 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)
           
 List<UUID> getAliases(UUID entityId)
           
 Application getApplication()
           
 Map<String,Object> getApplicationCollectionMetadata()
           
 Set<String> getApplicationCollections()
          Get all collections for the application.
 long getApplicationCollectionSize(String collectionName)
           
 org.springframework.context.ApplicationContext getApplicationContext()
           
 Map<String,Long> getApplicationCounters()
           
 UUID getApplicationId()
           
 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.
 CassandraService getCass()
           
 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 entity, String dictionaryName)
          Gets the set.
 Set<Object> getDictionaryAsSet(EntityRef entity, String dictionaryName)
          Gets the values from an entity list property.
 Object getDictionaryElementValue(EntityRef entity, String dictionaryName, String elementName)
           
 Map<String,Object> getDictionaryElementValues(EntityRef entity, String dictionaryName, String... elementNames)
           
 Set<String> getDictionaryNames(EntityRef entity)
           
<A extends Entity>
List<A>
getEntities(List<UUID> entityIds, String entityType, Class<A> entityClass)
          Gets the specified list of entities.
<A extends Entity>
A
getEntity(UUID entityId, String entityType, Class<A> entityClass)
          Gets the specified entity.
 Map<String,Long> getEntityCounters(UUID entityId)
           
 String getEntityType(UUID entityId)
          Gets the type.
 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 groupId)
           
 IndexBucketLocator getIndexBucketLocator()
           
 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.
 Set<String> getPropertyNames(EntityRef entity)
           
 EntityRef getRef(UUID entityId)
           
 RelationManagerImpl getRelationManager(EntityRef entityRef)
           
 Set<String> getRolePermissions(String roleName)
           
 Object getRolePermissionsKey(String roleName)
           
 Object getRolePermissionsKey(UUID groupId, String roleName)
           
 Map<String,String> getRoles()
           
 Map<String,Role> getRolesWithTitles(Set<String> roleNames)
           
 String getRoleTitle(String roleName)
           
 String getType(EntityRef entity)
           
 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)
           
 EntityRef groupRef(UUID groupId)
           
 void incrementAggregateCounters(UUID userId, UUID groupId, String category, Map<String,Long> counters)
           
 void incrementAggregateCounters(UUID userId, UUID groupId, String category, String counterName, long value)
           
 EntityManagerImpl init(EntityManagerFactoryImpl emf, CassandraService cass, CounterUtils counterUtils, UUID applicationId, boolean skipAggregateCounters)
           
 void insertEntity(String type, UUID entityId)
           
 boolean isPropertyValueUniqueForEntity(String entityType, String propertyName, Object propertyValue)
           
 boolean isPropertyValueUniqueForEntity(UUID thisEntity, String entityType, String propertyName, Object propertyValue)
          Returns true if the property is unique, and the entity can be saved.
 Results loadEntities(Results results, Results.Level resultsLevel, int count)
           
 Results loadEntities(Results results, Results.Level resultsLevel, Map<UUID,UUID> associatedMap, int count)
           
 DynamicEntity loadPartialEntity(UUID entityId, String... propertyNames)
          Gets the entity info.
 CollectionRef memberRef(UUID groupId, UUID userId)
           
 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 groupId, 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)
           
 EntityRef roleRef(String roleName)
           
 EntityRef roleRef(UUID groupId, String roleName)
           
 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.
 Message storeEventAsMessage(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m, Event event, long timestamp)
           
 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.
 void updateProperties(UUID entityId, Map<String,Object> properties)
          Update properties.
 EntityRef userRef(UUID userId)
           
 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.
 EntityRef validate(EntityRef entityRef, boolean verify)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APPLICATION_COLLECTION

public static final String APPLICATION_COLLECTION
See Also:
Constant Field Values

APPLICATION_ENTITIES

public static final String APPLICATION_ENTITIES
See Also:
Constant Field Values

ONE_COUNT

public static final long ONE_COUNT
See Also:
Constant Field Values

se

public static final me.prettyprint.cassandra.serializers.StringSerializer se

be

public static final me.prettyprint.cassandra.serializers.ByteBufferSerializer be

ue

public static final me.prettyprint.cassandra.serializers.UUIDSerializer ue

le

public static final me.prettyprint.cassandra.serializers.LongSerializer le
Constructor Detail

EntityManagerImpl

public EntityManagerImpl()
Method Detail

init

public EntityManagerImpl init(EntityManagerFactoryImpl emf,
                              CassandraService cass,
                              CounterUtils counterUtils,
                              UUID applicationId,
                              boolean skipAggregateCounters)

setApplicationId

public void setApplicationId(UUID applicationId)
Specified by:
setApplicationId in interface EntityManager

getApplicationContext

public org.springframework.context.ApplicationContext getApplicationContext()

getApplicationRef

public EntityRef getApplicationRef()
Specified by:
getApplicationRef in interface EntityManager

getApplication

public Application getApplication()
                           throws Exception
Specified by:
getApplication in interface EntityManager
Throws:
Exception

updateApplication

public void updateApplication(Application app)
                       throws Exception
Specified by:
updateApplication in interface EntityManager
Throws:
Exception

updateApplication

public void updateApplication(Map<String,Object> properties)
                       throws Exception
Specified by:
updateApplication in interface EntityManager
Throws:
Exception

getRelationManager

public RelationManagerImpl getRelationManager(EntityRef entityRef)
Specified by:
getRelationManager in interface EntityManager

batchSetProperty

public me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batchSetProperty(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch,
                                                                               Entity entity,
                                                                               String propertyName,
                                                                               Object propertyValue,
                                                                               UUID timestampUuid)
                                                                        throws Exception
Batch dictionary property.

Parameters:
batch - the batch
applicationId - the application id
entityType - the entity type
entityId - the entity id
properties - the properties
propertyName - the property name
propertyValue - the property value
timestamp - the timestamp
Returns:
batch
Throws:
Exception - the exception

batchSetProperty

public me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batchSetProperty(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch,
                                                                               Entity entity,
                                                                               String propertyName,
                                                                               Object propertyValue,
                                                                               boolean force,
                                                                               boolean noRead,
                                                                               UUID timestampUuid)
                                                                        throws Exception
Throws:
Exception

batchUpdateProperties

public me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batchUpdateProperties(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch,
                                                                                    Entity entity,
                                                                                    Map<String,Object> properties,
                                                                                    UUID timestampUuid)
                                                                             throws Exception
Batch update properties.

Parameters:
batch - the batch
applicationId - the application id
entityType - the entity type
entityId - the entity id
entityProperties - the entity properties
properties - the properties
timestamp - the timestamp
Returns:
batch
Throws:
Exception - the exception

batchUpdateProperties

public me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batchUpdateProperties(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch,
                                                                                    UUID entityId,
                                                                                    Map<String,Object> properties,
                                                                                    UUID timestampUuid)
                                                                             throws Exception
Batch update properties.

Parameters:
batch - the batch
applicationId - the application id
entityId - the entity id
properties - the properties
timestamp - the timestamp
Returns:
batch
Throws:
Exception - the exception

batchUpdateDictionary

public me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batchUpdateDictionary(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch,
                                                                                    Entity entity,
                                                                                    String dictionaryName,
                                                                                    Object elementValue,
                                                                                    boolean removeFromDictionary,
                                                                                    UUID timestampUuid)
                                                                             throws Exception
Batch update set.

Parameters:
batch - the batch
applicationId - the application id
entityType - the entity type
entityId - the entity id
properties - the properties
dictionaryName - the dictionary name
property - the property
elementValue - the dictionary value
removeFromSet - the remove from set
timestamp - the timestamp
Returns:
batch
Throws:
Exception - the exception

batchUpdateDictionary

public me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batchUpdateDictionary(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch,
                                                                                    Entity entity,
                                                                                    String dictionaryName,
                                                                                    Object elementValue,
                                                                                    Object elementCoValue,
                                                                                    boolean removeFromDictionary,
                                                                                    UUID timestampUuid)
                                                                             throws Exception
Throws:
Exception

isPropertyValueUniqueForEntity

public boolean isPropertyValueUniqueForEntity(UUID thisEntity,
                                              String entityType,
                                              String propertyName,
                                              Object propertyValue)
                                       throws Exception
Returns true if the property is unique, and the entity can be saved. If it's not unique, false is returned

Parameters:
thisEntity -
entityType -
propertyName -
propertyValue -
Returns:
Throws:
Exception

createAlias

public UUID createAlias(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> mutator,
                        UUID ownerId,
                        EntityRef ref,
                        String aliasType,
                        String alias,
                        long timestamp)
                 throws Exception
Throws:
Exception

deleteAlias

public void deleteAlias(UUID ownerId,
                        String aliasType,
                        String alias)
                 throws Exception
Specified by:
deleteAlias in interface EntityManager
Throws:
Exception

getAlias

public EntityRef getAlias(UUID ownerId,
                          String aliasType,
                          String alias)
                   throws Exception
Specified by:
getAlias in interface EntityManager
Throws:
Exception

getAlias

public Map<String,EntityRef> getAlias(String aliasType,
                                      List<String> aliases)
                               throws Exception
Specified by:
getAlias in interface EntityManager
Throws:
Exception

getAlias

public Map<String,EntityRef> getAlias(UUID ownerId,
                                      String aliasType,
                                      List<String> aliases)
                               throws Exception
Specified by:
getAlias in interface EntityManager
Throws:
Exception

getAliases

public List<UUID> getAliases(UUID entityId)

deleteAliasesForEntity

public void deleteAliasesForEntity(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> mutator,
                                   UUID entityId,
                                   long timestamp)
                            throws Exception
Throws:
Exception

create

public <A extends Entity> A create(String entityType,
                                   Class<A> entityClass,
                                   Map<String,Object> properties)
                        throws Exception
Specified by:
create in interface EntityManager
Throws:
Exception

create

public Entity create(UUID importId,
                     String entityType,
                     Map<String,Object> properties)
              throws Exception
Description copied from interface: EntityManager
Creates an entity of the specified type attached to the specified application.

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

create

public <A extends TypedEntity> A create(A entity)
                             throws Exception
Specified by:
create in interface EntityManager
Throws:
Exception

create

public Entity create(String entityType,
                     Map<String,Object> properties)
              throws Exception
Description copied from interface: EntityManager
Creates an entity of the specified type attached to the specified application.

Specified by:
create in interface EntityManager
properties - property values to create in the new entity or null.
Returns:
the newly created entity object.
Throws:
Exception

create

public <A extends Entity> A create(String entityType,
                                   Class<A> entityClass,
                                   Map<String,Object> properties,
                                   UUID importId)
                        throws Exception
Creates a new entity.

Type Parameters:
A - the generic type
Parameters:
applicationId - the application id
entityType - the entity type
entityClass - the entity class
properties - the properties
importId - an existing external uuid to use as the id for the new entity
Returns:
new entity
Throws:
Exception - the exception

batchCreate

public <A extends Entity> A batchCreate(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m,
                                        String entityType,
                                        Class<A> entityClass,
                                        Map<String,Object> properties,
                                        UUID importId,
                                        UUID timestampUuid)
                             throws Exception
Throws:
Exception

decrementEntityCollection

public void decrementEntityCollection(String collection_name)

decrementEntityCollection

public void decrementEntityCollection(String collection_name,
                                      long cassandraTimestamp)

insertEntity

public void insertEntity(String type,
                         UUID entityId)
                  throws Exception
Throws:
Exception

storeEventAsMessage

public Message storeEventAsMessage(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m,
                                   Event event,
                                   long timestamp)

getEntityType

public String getEntityType(UUID entityId)
                     throws Exception
Gets the type.

Parameters:
applicationId - the application id
entityId - the entity id
Returns:
entity type
Throws:
Exception - the exception

loadPartialEntity

public DynamicEntity loadPartialEntity(UUID entityId,
                                       String... propertyNames)
                                throws Exception
Gets the entity info.

Parameters:
applicationId - the application id
entityId - the entity id
propertyNames - the property names
Returns:
EntityInfo object holding properties
Throws:
Exception - the exception

getEntity

public <A extends Entity> A getEntity(UUID entityId,
                                      String entityType,
                                      Class<A> entityClass)
                           throws Exception
Gets the specified entity.

Type Parameters:
A - the generic type
Parameters:
applicationId - the application id
entityId - the entity id
entityType - the entity type
entityClass - the entity class
Returns:
entity
Throws:
Exception - the exception

getEntities

public <A extends Entity> List<A> getEntities(List<UUID> entityIds,
                                              String entityType,
                                              Class<A> entityClass)
                                   throws Exception
Gets the specified list of entities.

Type Parameters:
A - the generic type
Parameters:
applicationId - the application id
entityIds - the entity ids
includeProperties - the include properties
entityType - the entity type
entityClass - the entity class
Returns:
entity
Throws:
Exception - the exception

getPropertyNames

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

getDictionaryNames

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

getDictionaryElementValue

public Object getDictionaryElementValue(EntityRef entity,
                                        String dictionaryName,
                                        String elementName)
                                 throws Exception
Specified by:
getDictionaryElementValue in interface EntityManager
Throws:
Exception

getDictionaryElementValues

public Map<String,Object> getDictionaryElementValues(EntityRef entity,
                                                     String dictionaryName,
                                                     String... elementNames)
                                              throws Exception
Throws:
Exception

getDictionaryAsMap

public Map<Object,Object> getDictionaryAsMap(EntityRef entity,
                                             String dictionaryName)
                                      throws Exception
Gets the set.

Specified by:
getDictionaryAsMap in interface EntityManager
Parameters:
applicationId - the application id
entityType - the entity type
entityId - the entity id
dictionaryName - the dictionary name
joint - the joint
property - the property
Returns:
contents of dictionary property
Throws:
Exception - the exception

getDictionaryAsSet

public Set<Object> getDictionaryAsSet(EntityRef entity,
                                      String dictionaryName)
                               throws Exception
Description copied from interface: EntityManager
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.

Specified by:
getDictionaryAsSet in interface EntityManager
dictionaryName - the property list name to retrieve.
Returns:
the value of the named property or null.
Throws:
Exception - the exception

updateProperties

public void updateProperties(UUID entityId,
                             Map<String,Object> properties)
                      throws Exception
Update properties.

Parameters:
applicationId - the application id
entityId - the entity id
properties - the properties
Throws:
Exception - the exception

deleteEntity

public void deleteEntity(UUID entityId)
                  throws Exception
Throws:
Exception

delete

public void delete(EntityRef entityRef)
            throws Exception
Description copied from interface: EntityManager
Deletes the specified entity.

Specified by:
delete in interface EntityManager
Throws:
Exception - the exception

batchCreateRole

public void batchCreateRole(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch,
                            UUID groupId,
                            String roleName,
                            String roleTitle,
                            long inactivity,
                            RoleRef roleRef,
                            UUID timestampUuid)
                     throws Exception
Throws:
Exception

getUserByIdentifier

public EntityRef getUserByIdentifier(Identifier identifier)
                              throws Exception
Specified by:
getUserByIdentifier in interface EntityManager
Throws:
Exception

getGroupByIdentifier

public EntityRef getGroupByIdentifier(Identifier identifier)
                               throws Exception
Specified by:
getGroupByIdentifier in interface EntityManager
Throws:
Exception

getAggregateCounters

public Results getAggregateCounters(UUID userId,
                                    UUID groupId,
                                    String category,
                                    String counterName,
                                    CounterResolution resolution,
                                    long start,
                                    long finish,
                                    boolean pad)
Specified by:
getAggregateCounters in interface EntityManager

getAggregateCounters

public Results getAggregateCounters(UUID userId,
                                    UUID groupId,
                                    UUID queueId,
                                    String category,
                                    String counterName,
                                    CounterResolution resolution,
                                    long start,
                                    long finish,
                                    boolean pad)
Specified by:
getAggregateCounters in interface EntityManager

getAggregateCounters

public Results getAggregateCounters(Query query)
                             throws Exception
Specified by:
getAggregateCounters in interface EntityManager
Throws:
Exception

getEntityCounters

public Map<String,Long> getEntityCounters(UUID entityId)
                                   throws Exception
Specified by:
getEntityCounters in interface EntityManager
Throws:
Exception

getApplicationCounters

public Map<String,Long> getApplicationCounters()
                                        throws Exception
Specified by:
getApplicationCounters in interface EntityManager
Throws:
Exception

createApplicationCollection

public void createApplicationCollection(String entityType)
                                 throws Exception
Specified by:
createApplicationCollection in interface EntityManager
Throws:
Exception

deleteAlias

public void deleteAlias(String aliasType,
                        String alias)
                 throws Exception
Specified by:
deleteAlias in interface EntityManager
Throws:
Exception

getAlias

public EntityRef getAlias(String aliasType,
                          String alias)
                   throws Exception
Specified by:
getAlias in interface EntityManager
Throws:
Exception

validate

public EntityRef validate(EntityRef entityRef)
                   throws Exception
Description copied from interface: EntityManager
Validates that the entity exists in the datastore meaning that it exists and the type has been loaded if not already provided.

Specified by:
validate in interface EntityManager
Returns:
an validated EntityRef or null.
Throws:
Exception

validate

public EntityRef validate(EntityRef entityRef,
                          boolean verify)
                   throws Exception
Throws:
Exception

getType

public String getType(UUID entityid)
               throws Exception
Specified by:
getType in interface EntityManager
Throws:
Exception

getType

public String getType(EntityRef entity)
               throws Exception
Throws:
Exception

get

public Entity get(UUID entityid)
           throws Exception
Specified by:
get in interface EntityManager
Throws:
Exception

getRef

public EntityRef getRef(UUID entityId)
                 throws Exception
Specified by:
getRef in interface EntityManager
Throws:
Exception

get

public Entity get(EntityRef entityRef)
           throws Exception
Description copied from interface: EntityManager
Retrieves the entity for the specified entity reference.

Specified by:
get in interface EntityManager
Returns:
an Entity object for the specified entity reference.
Throws:
Exception

get

public <A extends Entity> A get(EntityRef entityRef,
                                Class<A> entityClass)
                     throws Exception
Specified by:
get in interface EntityManager
Throws:
Exception

get

public <A extends Entity> A get(UUID entityId,
                                Class<A> entityClass)
                     throws Exception
Specified by:
get in interface EntityManager
Throws:
Exception

get

public Results get(List<UUID> entityIds,
                   Results.Level resultsLevel)
            throws Exception
Description copied from interface: EntityManager
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.

Specified by:
get in interface EntityManager
Parameters:
entityIds - a list of entity UUIDs.
Returns:
a list of entity objects.
Throws:
Exception

get

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

Specified by:
get in interface EntityManager
Returns:
a list of entity objects.
Throws:
Exception

get

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

Specified by:
get in interface EntityManager
Returns:
a list of entity objects.
Throws:
Exception

loadEntities

public Results loadEntities(Results results,
                            Results.Level resultsLevel,
                            int count)
                     throws Exception
Throws:
Exception

loadEntities

public Results loadEntities(Results results,
                            Results.Level resultsLevel,
                            Map<UUID,UUID> associatedMap,
                            int count)
                     throws Exception
Throws:
Exception

update

public void update(Entity entity)
            throws Exception
Description copied from interface: EntityManager
Updates the entity with the properties and values in the Entity Object.

Specified by:
update in interface EntityManager
Parameters:
entity - an Entity object.
Throws:
Exception

getProperty

public Object getProperty(EntityRef entityRef,
                          String propertyName)
                   throws Exception
Description copied from interface: EntityManager
Gets the value for a named entity property. Entity properties must be defined in the schema

Specified by:
getProperty in interface EntityManager
propertyName - the property name to retrieve.
Returns:
the value of the named property or null.
Throws:
Exception - the exception

getProperties

public Map<String,Object> getProperties(EntityRef entityRef)
                                 throws Exception
Description copied from interface: EntityManager
Gets the properties for the specified entity property.

Specified by:
getProperties in interface EntityManager
Returns:
the property values.
Throws:
Exception - the exception

setProperty

public void setProperty(EntityRef entityRef,
                        String propertyName,
                        Object propertyValue)
                 throws Exception
Description copied from interface: EntityManager
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.

Specified by:
setProperty in interface EntityManager
propertyName - the property to set.
propertyValue - new value for property.
Throws:
Exception - the exception

setProperty

public void setProperty(EntityRef entityRef,
                        String propertyName,
                        Object propertyValue,
                        boolean override)
                 throws Exception
Description copied from interface: EntityManager
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....

Specified by:
setProperty in interface EntityManager
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

public void updateProperties(EntityRef entityRef,
                             Map<String,Object> properties)
                      throws Exception
Description copied from interface: EntityManager
Updates the properties for the specified entity.

Specified by:
updateProperties in interface EntityManager
properties - the properties
Throws:
Exception - the exception

addToDictionary

public void addToDictionary(EntityRef entityRef,
                            String dictionaryName,
                            Object elementValue)
                     throws Exception
Description copied from interface: EntityManager
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.

Specified by:
addToDictionary in interface EntityManager
dictionaryName - the property to set.
elementValue - new value for property.
Throws:
Exception - the exception

addToDictionary

public void addToDictionary(EntityRef entityRef,
                            String dictionaryName,
                            Object elementValue,
                            Object elementCoValue)
                     throws Exception
Specified by:
addToDictionary in interface EntityManager
Throws:
Exception

addSetToDictionary

public void addSetToDictionary(EntityRef entityRef,
                               String dictionaryName,
                               Set<?> elementValues)
                        throws Exception
Specified by:
addSetToDictionary in interface EntityManager
Throws:
Exception

addMapToDictionary

public void addMapToDictionary(EntityRef entityRef,
                               String dictionaryName,
                               Map<?,?> elementValues)
                        throws Exception
Specified by:
addMapToDictionary in interface EntityManager
Throws:
Exception

removeFromDictionary

public void removeFromDictionary(EntityRef entityRef,
                                 String dictionaryName,
                                 Object elementValue)
                          throws Exception
Description copied from interface: EntityManager
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.

Specified by:
removeFromDictionary in interface EntityManager
dictionaryName - the property to set.
elementValue - new value for property.
Throws:
Exception - the exception

getDictionaries

public Set<String> getDictionaries(EntityRef entity)
                            throws Exception
Specified by:
getDictionaries in interface EntityManager
Throws:
Exception

deleteProperty

public void deleteProperty(EntityRef entityRef,
                           String propertyName)
                    throws Exception
Specified by:
deleteProperty in interface EntityManager
Throws:
Exception

getApplicationCollections

public Set<String> getApplicationCollections()
                                      throws Exception
Description copied from interface: EntityManager
Get all collections for the application. Includes both user defined collections and schema collections

Specified by:
getApplicationCollections in interface EntityManager
Returns:
Throws:
Exception

getApplicationCollectionSize

public long getApplicationCollectionSize(String collectionName)
                                  throws Exception
Specified by:
getApplicationCollectionSize in interface EntityManager
Throws:
Exception

getApplicationCollectionMetadata

public Map<String,Object> getApplicationCollectionMetadata()
                                                    throws Exception
Specified by:
getApplicationCollectionMetadata in interface EntityManager
Throws:
Exception

getRolePermissionsKey

public Object getRolePermissionsKey(String roleName)

getRolePermissionsKey

public Object getRolePermissionsKey(UUID groupId,
                                    String roleName)

userRef

public EntityRef userRef(UUID userId)

groupRef

public EntityRef groupRef(UUID groupId)

roleRef

public EntityRef roleRef(String roleName)

roleRef

public EntityRef roleRef(UUID groupId,
                         String roleName)

getRoles

public Map<String,String> getRoles()
                            throws Exception
Specified by:
getRoles in interface EntityManager
Throws:
Exception

getRoleTitle

public String getRoleTitle(String roleName)
                    throws Exception
Specified by:
getRoleTitle in interface EntityManager
Throws:
Exception

getRolesWithTitles

public Map<String,Role> getRolesWithTitles(Set<String> roleNames)
                                    throws Exception
Specified by:
getRolesWithTitles in interface EntityManager
Throws:
Exception

createRole

public Entity createRole(String roleName,
                         String roleTitle,
                         long inactivity)
                  throws Exception
Description copied from interface: EntityManager
Create the role with the title and inactivity

Specified by:
createRole in interface EntityManager
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

public void grantRolePermission(String roleName,
                                String permission)
                         throws Exception
Specified by:
grantRolePermission in interface EntityManager
Throws:
Exception

grantRolePermissions

public void grantRolePermissions(String roleName,
                                 Collection<String> permissions)
                          throws Exception
Specified by:
grantRolePermissions in interface EntityManager
Throws:
Exception

revokeRolePermission

public void revokeRolePermission(String roleName,
                                 String permission)
                          throws Exception
Specified by:
revokeRolePermission in interface EntityManager
Throws:
Exception

getRolePermissions

public Set<String> getRolePermissions(String roleName)
                               throws Exception
Specified by:
getRolePermissions in interface EntityManager
Throws:
Exception

deleteRole

public void deleteRole(String roleName)
                throws Exception
Specified by:
deleteRole in interface EntityManager
Throws:
Exception

memberRef

public CollectionRef memberRef(UUID groupId,
                               UUID userId)

getGroupRoles

public Map<String,String> getGroupRoles(UUID groupId)
                                 throws Exception
Specified by:
getGroupRoles in interface EntityManager
Throws:
Exception

createGroupRole

public Entity createGroupRole(UUID groupId,
                              String roleName,
                              long inactivity)
                       throws Exception
Description copied from interface: EntityManager
Create a group role with the group id, roleName, and inactivity

Specified by:
createGroupRole in interface EntityManager
Returns:
Throws:
Exception

grantGroupRolePermission

public void grantGroupRolePermission(UUID groupId,
                                     String roleName,
                                     String permission)
                              throws Exception
Specified by:
grantGroupRolePermission in interface EntityManager
Throws:
Exception

revokeGroupRolePermission

public void revokeGroupRolePermission(UUID groupId,
                                      String roleName,
                                      String permission)
                               throws Exception
Specified by:
revokeGroupRolePermission in interface EntityManager
Throws:
Exception

getGroupRolePermissions

public Set<String> getGroupRolePermissions(UUID groupId,
                                           String roleName)
                                    throws Exception
Specified by:
getGroupRolePermissions in interface EntityManager
Throws:
Exception

deleteGroupRole

public void deleteGroupRole(UUID groupId,
                            String roleName)
                     throws Exception
Specified by:
deleteGroupRole in interface EntityManager
Throws:
Exception

getUserRoles

public Set<String> getUserRoles(UUID userId)
                         throws Exception
Specified by:
getUserRoles in interface EntityManager
Throws:
Exception

getUserRolesWithTitles

public Map<String,Role> getUserRolesWithTitles(UUID userId)
                                        throws Exception
Specified by:
getUserRolesWithTitles in interface EntityManager
Throws:
Exception

addUserToRole

public void addUserToRole(UUID userId,
                          String roleName)
                   throws Exception
Specified by:
addUserToRole in interface EntityManager
Throws:
Exception

removeUserFromRole

public void removeUserFromRole(UUID userId,
                               String roleName)
                        throws Exception
Specified by:
removeUserFromRole in interface EntityManager
Throws:
Exception

getUserPermissions

public Set<String> getUserPermissions(UUID userId)
                               throws Exception
Specified by:
getUserPermissions in interface EntityManager
Throws:
Exception

grantUserPermission

public void grantUserPermission(UUID userId,
                                String permission)
                         throws Exception
Specified by:
grantUserPermission in interface EntityManager
Throws:
Exception

revokeUserPermission

public void revokeUserPermission(UUID userId,
                                 String permission)
                          throws Exception
Specified by:
revokeUserPermission in interface EntityManager
Throws:
Exception

getUserGroupRoles

public Map<String,String> getUserGroupRoles(UUID userId,
                                            UUID groupId)
                                     throws Exception
Specified by:
getUserGroupRoles in interface EntityManager
Throws:
Exception

addUserToGroupRole

public void addUserToGroupRole(UUID userId,
                               UUID groupId,
                               String roleName)
                        throws Exception
Specified by:
addUserToGroupRole in interface EntityManager
Throws:
Exception

removeUserFromGroupRole

public void removeUserFromGroupRole(UUID userId,
                                    UUID groupId,
                                    String roleName)
                             throws Exception
Specified by:
removeUserFromGroupRole in interface EntityManager
Throws:
Exception

getUsersInGroupRole

public Results getUsersInGroupRole(UUID groupId,
                                   String roleName,
                                   Results.Level level)
                            throws Exception
Specified by:
getUsersInGroupRole in interface EntityManager
Throws:
Exception

incrementAggregateCounters

public void incrementAggregateCounters(UUID userId,
                                       UUID groupId,
                                       String category,
                                       String counterName,
                                       long value)
Specified by:
incrementAggregateCounters in interface EntityManager

incrementAggregateCounters

public void incrementAggregateCounters(UUID userId,
                                       UUID groupId,
                                       String category,
                                       Map<String,Long> counters)
Specified by:
incrementAggregateCounters in interface EntityManager

getCounterNames

public Set<String> getCounterNames()
                            throws Exception
Specified by:
getCounterNames in interface EntityManager
Throws:
Exception

isPropertyValueUniqueForEntity

public boolean isPropertyValueUniqueForEntity(String entityType,
                                              String propertyName,
                                              Object propertyValue)
                                       throws Exception
Specified by:
isPropertyValueUniqueForEntity in interface EntityManager
Throws:
Exception

getOwners

public Map<String,Map<UUID,Set<String>>> getOwners(EntityRef entityRef)
                                            throws Exception
Description copied from interface: EntityManager
Gets the entities and collections that the specified entity is a member of.

Specified by:
getOwners in interface EntityManager
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

public Set<String> getCollections(EntityRef entityRef)
                           throws Exception
Description copied from interface: EntityManager
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.

Specified by:
getCollections in interface EntityManager
Returns:
the collections for the entity type of the given entity.
Throws:
Exception - the exception

getCollection

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

Specified by:
getCollection in interface EntityManager
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

public Results getCollection(UUID entityId,
                             String collectionName,
                             Query query,
                             Results.Level resultsLevel)
                      throws Exception
Specified by:
getCollection in interface EntityManager
Throws:
Exception

addToCollection

public Entity addToCollection(EntityRef entityRef,
                              String collectionName,
                              EntityRef itemRef)
                       throws Exception
Description copied from interface: EntityManager
Adds an entity to the specified collection belonging to the specified entity entity.

Specified by:
addToCollection in interface EntityManager
collectionName - the collection name.
Throws:
Exception - the exception

addToCollections

public Entity addToCollections(List<EntityRef> ownerEntities,
                               String collectionName,
                               EntityRef itemRef)
                        throws Exception
Specified by:
addToCollections in interface EntityManager
Throws:
Exception

createItemInCollection

public Entity createItemInCollection(EntityRef entityRef,
                                     String collectionName,
                                     String itemType,
                                     Map<String,Object> properties)
                              throws Exception
Specified by:
createItemInCollection in interface EntityManager
Throws:
Exception

removeFromCollection

public void removeFromCollection(EntityRef entityRef,
                                 String collectionName,
                                 EntityRef itemRef)
                          throws Exception
Description copied from interface: EntityManager
Removes an entity to the specified collection belonging to the specified entity.

Specified by:
removeFromCollection in interface EntityManager
collectionName - the collection name.
Throws:
Exception - the exception

copyRelationships

public void copyRelationships(EntityRef srcEntityRef,
                              String srcRelationName,
                              EntityRef dstEntityRef,
                              String dstRelationName)
                       throws Exception
Specified by:
copyRelationships in interface EntityManager
Throws:
Exception

searchCollection

public Results searchCollection(EntityRef entityRef,
                                String collectionName,
                                Query query)
                         throws Exception
Specified by:
searchCollection in interface EntityManager
Throws:
Exception

getCollectionIndexes

public Set<String> getCollectionIndexes(EntityRef entity,
                                        String collectionName)
                                 throws Exception
Specified by:
getCollectionIndexes in interface EntityManager
Throws:
Exception

createConnection

public ConnectionRef createConnection(ConnectionRef connection)
                               throws Exception
Description copied from interface: EntityManager
Connect the specified entity to another entity with the specified connection type. Connections are directional relationships that can be traversed in either direction.

Specified by:
createConnection in interface EntityManager
Throws:
Exception - the exception

createConnection

public ConnectionRef createConnection(EntityRef connectingEntity,
                                      String connectionType,
                                      EntityRef connectedEntityRef)
                               throws Exception
Specified by:
createConnection in interface EntityManager
Throws:
Exception

createConnection

public ConnectionRef createConnection(EntityRef connectingEntity,
                                      String pairedConnectionType,
                                      EntityRef pairedEntity,
                                      String connectionType,
                                      EntityRef connectedEntityRef)
                               throws Exception
Specified by:
createConnection in interface EntityManager
Throws:
Exception

createConnection

public ConnectionRef createConnection(EntityRef connectingEntity,
                                      ConnectedEntityRef... connections)
                               throws Exception
Specified by:
createConnection in interface EntityManager
Throws:
Exception

connectionRef

public ConnectionRef connectionRef(EntityRef connectingEntity,
                                   String connectionType,
                                   EntityRef connectedEntityRef)
                            throws Exception
Specified by:
connectionRef in interface EntityManager
Throws:
Exception

connectionRef

public ConnectionRef connectionRef(EntityRef connectingEntity,
                                   String pairedConnectionType,
                                   EntityRef pairedEntity,
                                   String connectionType,
                                   EntityRef connectedEntityRef)
                            throws Exception
Specified by:
connectionRef in interface EntityManager
Throws:
Exception

connectionRef

public ConnectionRef connectionRef(EntityRef connectingEntity,
                                   ConnectedEntityRef... connections)
Specified by:
connectionRef in interface EntityManager

deleteConnection

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

Specified by:
deleteConnection in interface EntityManager
Throws:
Exception - the exception

connectionExists

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

Specified by:
connectionExists in interface EntityManager
Returns:
a list of entities connecting to this one.
Throws:
Exception - the exception

getConnectionTypes

public Set<String> getConnectionTypes(UUID entityId,
                                      UUID connectedEntityId)
                               throws Exception
Description copied from interface: EntityManager
Gets the types of connections between two entities.

Specified by:
getConnectionTypes in interface EntityManager
Returns:
a set of the connection types between the two entities.
Throws:
Exception - the exception

getConnectionTypes

public Set<String> getConnectionTypes(EntityRef ref)
                               throws Exception
Specified by:
getConnectionTypes in interface EntityManager
Throws:
Exception

getConnectionTypes

public Set<String> getConnectionTypes(EntityRef ref,
                                      boolean filterConnection)
                               throws Exception
Specified by:
getConnectionTypes in interface EntityManager
Throws:
Exception

getConnectedEntities

public Results getConnectedEntities(UUID entityId,
                                    String connectionType,
                                    String connectedEntityType,
                                    Results.Level resultsLevel)
                             throws Exception
Description copied from interface: EntityManager
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.

Specified by:
getConnectedEntities in interface EntityManager
connectionType - type of connection or null.
connectedEntityType - type of entity or null.
Returns:
a list of connected entity ids.
Throws:
Exception - the exception

getConnectingEntities

public Results getConnectingEntities(UUID entityId,
                                     String connectionType,
                                     String connectedEntityType,
                                     Results.Level resultsLevel)
                              throws Exception
Description copied from interface: EntityManager
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"

Specified by:
getConnectingEntities in interface EntityManager
connectionType - type of connection or null.
Returns:
a list of entities connecting to this one.
Throws:
Exception - the exception

getConnections

public List<ConnectedEntityRef> getConnections(UUID entityId,
                                               Query query)
                                        throws Exception
Specified by:
getConnections in interface EntityManager
Throws:
Exception

searchConnectedEntities

public Results searchConnectedEntities(EntityRef connectingEntity,
                                       Query query)
                                throws Exception
Specified by:
searchConnectedEntities in interface EntityManager
Throws:
Exception

getAssociatedProperty

public Object getAssociatedProperty(AssociatedEntityRef associatedEntityRef,
                                    String propertyName)
                             throws Exception
Description copied from interface: EntityManager
Gets the value for a named connection property. Connection properties are properties associated with a connection.

Specified by:
getAssociatedProperty in interface EntityManager
propertyName - the property name to retrieve.
Returns:
the value of the named property or null.
Throws:
Exception - the exception

getAssociatedProperties

public Map<String,Object> getAssociatedProperties(AssociatedEntityRef associatedEntityRef)
                                           throws Exception
Description copied from interface: EntityManager
Gets the connection properties for this entity.

Specified by:
getAssociatedProperties in interface EntityManager
Returns:
the property values.
Throws:
Exception - the exception

setAssociatedProperty

public void setAssociatedProperty(AssociatedEntityRef associatedEntityRef,
                                  String propertyName,
                                  Object propertyValue)
                           throws Exception
Description copied from interface: EntityManager
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.

Specified by:
setAssociatedProperty in interface EntityManager
propertyName - the property to set.
propertyValue - new value for property.
Throws:
Exception - the exception

searchConnections

public List<ConnectionRef> searchConnections(EntityRef connectingEntity,
                                             Query query)
                                      throws Exception
Specified by:
searchConnections in interface EntityManager
Throws:
Exception

getConnectionIndexes

public Set<String> getConnectionIndexes(EntityRef entity,
                                        String connectionType)
                                 throws Exception
Specified by:
getConnectionIndexes in interface EntityManager
Throws:
Exception

resetRoles

public void resetRoles()
                throws Exception
Specified by:
resetRoles in interface EntityManager
Throws:
Exception

getApplicationId

public UUID getApplicationId()
Returns:
the applicationId

getCass

public CassandraService getCass()
Returns:
the cass

getGeoIndexManager

public GeoIndexManager getGeoIndexManager()
Specified by:
getGeoIndexManager in interface EntityManager

getIndexBucketLocator

public IndexBucketLocator getIndexBucketLocator()
Returns:
the indexBucketLocator

getGroupRolesWithTitles

public Map<String,Role> getGroupRolesWithTitles(UUID groupId)
                                         throws Exception
Specified by:
getGroupRolesWithTitles in interface EntityManager
Throws:
Exception

addGroupToRole

public void addGroupToRole(UUID groupId,
                           String roleName)
                    throws Exception
Specified by:
addGroupToRole in interface EntityManager
Throws:
Exception

removeGroupFromRole

public void removeGroupFromRole(UUID groupId,
                                String roleName)
                         throws Exception
Specified by:
removeGroupFromRole in interface EntityManager
Throws:
Exception

getGroupPermissions

public Set<String> getGroupPermissions(UUID groupId)
                                throws Exception
Specified by:
getGroupPermissions in interface EntityManager
Throws:
Exception

grantGroupPermission

public void grantGroupPermission(UUID groupId,
                                 String permission)
                          throws Exception
Specified by:
grantGroupPermission in interface EntityManager
Throws:
Exception

revokeGroupPermission

public void revokeGroupPermission(UUID groupId,
                                  String permission)
                           throws Exception
Specified by:
revokeGroupPermission in interface EntityManager
Throws:
Exception


Copyright © 2013. All Rights Reserved.