Interface EntityService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Set<Entity>
createEntities(java.util.Set<CreateEntityRequest> entities)
Creates entities for the given input requests.Entity
createEntity(long systemId, java.util.Map<java.lang.String,java.lang.Object> entityKey, java.util.Map<java.lang.String,java.lang.Object> partitionKey)
Creates an entity for the given input criteria.java.util.Set<Entity>
findAll(cern.nxcals.api.metadata.queries.ConditionWithOptions<cern.nxcals.api.metadata.queries.Entities,cern.nxcals.api.metadata.queries.EntityQueryWithOptions> condition)
Find all entities which match condition.java.util.List<Entity>
findAll(cern.nxcals.api.metadata.queries.EntityQueryWithOptions options)
Find all entities which match condition.java.util.Set<Entity>
findAllWithHistory(com.github.rutledgepaulv.qbuilders.conditions.Condition<cern.nxcals.api.extraction.metadata.queries.Entities> condition, long historyStartTime, long historyEndTime)
Searching for multiple values.java.util.Optional<Entity>
findOne(cern.nxcals.api.metadata.queries.ConditionWithOptions<cern.nxcals.api.metadata.queries.Entities,cern.nxcals.api.metadata.queries.EntityQueryWithOptions> condition)
Find one entity which match condition.java.util.Optional<Entity>
findOne(cern.nxcals.api.metadata.queries.EntityQueryWithOptions options)
Find one entity which match condition.java.util.Optional<Entity>
findOneWithHistory(com.github.rutledgepaulv.qbuilders.conditions.Condition<cern.nxcals.api.extraction.metadata.queries.Entities> condition, long historyStartTime, long historyEndTime)
Searching for one value.java.util.Set<Entity>
updateEntities(java.util.Set<Entity> entityDataList)
Updates a set of entities.
-
-
-
Method Detail
-
findAllWithHistory
java.util.Set<Entity> findAllWithHistory(com.github.rutledgepaulv.qbuilders.conditions.Condition<cern.nxcals.api.extraction.metadata.queries.Entities> condition, long historyStartTime, long historyEndTime)
Searching for multiple values.- Parameters:
condition
- entity search criteriahistoryStartTime
- in nanoseconds elapsed since 1970-01-01 00:00:00 in the UTC timezonehistoryEndTime
- in nanoseconds elapsed since 1970-01-01 00:00:00 in the UTC timezone- Returns:
- a
Set
of found entities.
-
findOneWithHistory
java.util.Optional<Entity> findOneWithHistory(com.github.rutledgepaulv.qbuilders.conditions.Condition<cern.nxcals.api.extraction.metadata.queries.Entities> condition, long historyStartTime, long historyEndTime)
Searching for one value. If the metadata returns multiple values the exception is thrown (@seeIllegalStateException
)- Parameters:
condition
- entity search criteriahistoryStartTime
- in nanoseconds elapsed since 1970-01-01 00:00:00 in the UTC timezonehistoryEndTime
- in nanoseconds elapsed since 1970-01-01 00:00:00 in the UTC timezone- Returns:
- Optional with value or empty.
- Throws:
java.lang.IllegalStateException
- if found multiple values.
-
updateEntities
java.util.Set<Entity> updateEntities(java.util.Set<Entity> entityDataList)
Updates a set of entities. NOTE: this is a mutative method. It is not thread-safe or meant to be used in parallel- Parameters:
entityDataList
- aSet
ofEntity
s that identify the entities to be updated. We only allow change of the keyValues and lock/unlock for operation.- Returns:
- a
Set
of updated entities.
-
createEntity
Entity createEntity(long systemId, java.util.Map<java.lang.String,java.lang.Object> entityKey, java.util.Map<java.lang.String,java.lang.Object> partitionKey)
Creates an entity for the given input criteria. NOTE: this is a mutative method. It is not thread-safe or meant to be used in parallel- Parameters:
systemId
-entityKey
-partitionKey
-- Returns:
- created entity
- Throws:
cern.nxcals.api.exceptions.FatalDataConflictRuntimeException
- if such entity existsjava.lang.IllegalArgumentException
- if systemId does not exist or entityKey or partitionKey are invalid
-
createEntities
java.util.Set<Entity> createEntities(java.util.Set<CreateEntityRequest> entities)
Creates entities for the given input requests. NOTE: this is a mutative method. It is not thread-safe or meant to be used in parallel- Parameters:
entities
- a set ofCreateEntityRequest
based on which new entities should be created- Returns:
- a
Set
of created entities - Throws:
cern.nxcals.api.exceptions.FatalDataConflictRuntimeException
- if such entity existsjava.lang.IllegalArgumentException
- if systemId does not exist or entityKeyValues or partitionKeyValues are invalid
-
findAll
@Experimental java.util.List<Entity> findAll(cern.nxcals.api.metadata.queries.EntityQueryWithOptions options)
Find all entities which match condition. Can be configured with additional options.- Parameters:
options
- query with options, like limit- Returns:
- a
List
of found entities.
-
findOne
@Experimental java.util.Optional<Entity> findOne(cern.nxcals.api.metadata.queries.EntityQueryWithOptions options)
Find one entity which match condition. Can be configured with additional options.- Parameters:
options
- query with options, like limit- Returns:
- an
Optional
withEntity
-
findAll
@Experimental java.util.Set<Entity> findAll(cern.nxcals.api.metadata.queries.ConditionWithOptions<cern.nxcals.api.metadata.queries.Entities,cern.nxcals.api.metadata.queries.EntityQueryWithOptions> condition)
Find all entities which match condition.- Parameters:
condition
- query- Returns:
- a
List
of found entities.
-
findOne
@Experimental java.util.Optional<Entity> findOne(cern.nxcals.api.metadata.queries.ConditionWithOptions<cern.nxcals.api.metadata.queries.Entities,cern.nxcals.api.metadata.queries.EntityQueryWithOptions> condition)
Find one entity which match condition.- Parameters:
condition
- query, must match zero or one entity- Returns:
- an
Optional
withEntity
-
-