|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Entityhub
The Entityhub defines an interface that allows to manage Entities.
Entities managed by the Entityhub are often referred by "locally managed
Entities" to differentiate them form entities managed by
ReferencedSites.
The Entityhub supports full CRUD support for Entities and also allows to import Entities from Referenced sites.
In addition to Entities the Entityhub also allows to work with mappings
between Entities of ReferencedSites with locally managed Entities.
| Field Summary | |
|---|---|
static String |
DEFAUTL_ENTITYHUB_PREFIX
|
static Set<String> |
ENTITYHUB_IDS
Protected keys to be used as name for the Entityhub. |
| Method Summary | |
|---|---|
Entity |
delete(String id)
Deletes the Entity with the parsed id. |
QueryResultList<Representation> |
find(FieldQuery query)
Searches for symbols based on the parsed FieldQuery and returns
representations as defined by the selected fields of the query. |
QueryResultList<Entity> |
findEntities(FieldQuery query)
Searches for Signs based on the parsed FieldQuery and returns
the selected Signs including the whole representation. |
QueryResultList<String> |
findEntityReferences(FieldQuery query)
Searches for symbols based on the parsed FieldQuery and returns
the references (ids). |
EntityhubConfiguration |
getConfig()
Getter for the Configuration of the Entityhub |
Entity |
getEntity(String entityId)
Getter for an Entity managed by the Entityhub. |
FieldMapper |
getFieldMappings()
Getter for the FieldMappings configured for this Site |
Entity |
getMappingById(String id)
Getter for a MappedEntity based on the ID of the mapping itself. |
Entity |
getMappingBySource(String source)
Getter for all mappings by the ID of the source. |
Collection<Entity> |
getMappingsByTarget(String entityId)
Getter for all the mappings by the id of the target. |
FieldQueryFactory |
getQueryFactory()
Getter for the FieldQueryFactory instance of the Entityhub. |
Yard |
getYard()
Getter for the Yard storing the Entities and Mappings managed by this Entityhub. |
Entity |
importEntity(String reference)
Imports an Entity from a referenced site to the Entityhub. |
boolean |
isRepresentation(String id)
Checks if an Entity with the parsed id is managed by the Entityhub. |
Entity |
lookupLocalEntity(String reference)
Getter for the locally managed Entity based on a reference to a Entity. |
Entity |
lookupLocalEntity(String reference,
boolean create)
Getter for the locally managed Entity based on a reference to a Entity. |
Entity |
setState(String id,
ManagedEntityState state)
Setter for the state of an Entity. |
Entity |
store(Representation representation)
Stores (create or updates) the parsed representation within the Entityhub. |
| Field Detail |
|---|
static final String DEFAUTL_ENTITYHUB_PREFIX
static final Set<String> ENTITYHUB_IDS
ids for
ReferencedSites. (case insensitive)The protected values are
"local"
"entityhub"
| Method Detail |
|---|
Yard getYard()
Note that the Yard can be reconfigured without restarting the Entityhub.
Entity lookupLocalEntity(String reference)
throws EntityhubException
Entity. If a id of an locally managed Entity is parsed this
Entity is returned. In any other case this Method searches if the parsed
reference is mapped to a locally managed Entity and returns this Entity
instead.
reference - the id of any Entity
null if
no symbol for the parsed entity is available
EntityhubException - On any error while performing the operation
Entity lookupLocalEntity(String reference,
boolean create)
throws IllegalArgumentException,
EntityhubException
Entity. If a id of an locally managed Entity is parsed this
Entity is returned. In any other case this Method searches if the parsed
reference is mapped to a locally managed Entity and returns this Entity
instead.
If create=true this method can imports Entities to the
entityhub based on the definition(s) of referenced sites.
reference - the id of the referenced Entitycreate - if true the Entityhub will try to create a
new locally managed Entity by importing an Entity from
referenced sites.
null if the parsed reference is not
known by any referenced sites.
IllegalArgumentException - If the referenced Entity was found, no
existing EntityMapping is present, but it is not possible to
create a locally managed Entity for the referenced Entity
(normally this is because of insufficient/invalid information of the
referenced Entity.
EntityhubException - On any error while performing the operation
Entity getEntity(String entityId)
throws IllegalArgumentException,
EntityhubException
entityId - the ID of the locally managed Entity
null if no Entity with that
ID is managed by the Entityhub.
IllegalArgumentException - if null or an empty String
is parsed as symbolId or if the parsed ID does not represent a
Entity
EntityhubException - On any error while performing the operation
Entity importEntity(String reference)
throws IllegalStateException,
IllegalArgumentException,
EntityhubException
IllegalStateException. If the referenced Entity is not found on
any referenced site, than null is returned.
If the referenced Entity provides insufficient data to create a
locally managed Entity, than an IllegalArgumentException is thrown.
reference - the id of the Entity to import
null if the import was not
successful.
IllegalStateException - if there exists already a Entity for
the parsed reference in the entityhub
IllegalArgumentException - If an import is not possible (e.g.
because the Representation of the Entity provides
insufficient data or some configuration that importing Entities from this
referenced site is not allowed).
EntityhubException - On any error while performing the operation
Entity getMappingById(String id)
throws EntityhubException,
IllegalArgumentException
id - the id of the mapped entity
null if none was found
EntityhubException - On any error while performing the operation
IllegalArgumentException - If null or an empty string
is parsed as ID or if the parsed ID does not represent an
EntityMapping
Entity getMappingBySource(String source)
throws EntityhubException
source - the ID of the source (an entity managed by some referenced
site)
EntityhubException - On any error while performing the operationFieldQueryFactory getQueryFactory()
FieldQueryFactory instance of the Entityhub. Typical
implementation will return the factory implementation used by the current
Yard used by the entity hub.
FieldMapper getFieldMappings()
FieldMapping present for this Site.
Collection<Entity> getMappingsByTarget(String entityId)
throws EntityhubException
entityId - the id of the target (a locally managed entity)
EntityhubException - On any error while performing the operation
QueryResultList<String> findEntityReferences(FieldQuery query)
throws EntityhubException
FieldQuery and returns
the references (ids). Note that selected fields of the query are ignored.
query - the query
EntityhubException - On any error while performing the operation
QueryResultList<Representation> find(FieldQuery query)
throws EntityhubException
FieldQuery and returns
representations as defined by the selected fields of the query. Note that
if the query defines also Constraints for selected fields, that
the returned representation will only contain values selected by such
constraints.
query - the query
EntityhubException - On any error while performing the operation
QueryResultList<Entity> findEntities(FieldQuery query)
throws EntityhubException
FieldQuery and returns
the selected Signs including the whole representation. Note that selected
fields of the query are ignored.
query - the query
EntityhubException - On any error while performing the operation
boolean isRepresentation(String id)
throws EntityhubException,
IllegalArgumentException
id - the id of the entity
EntityhubException - On any error while performing the operation
IllegalArgumentException - if null or an empty String
is parsed as id
Entity store(Representation representation)
throws EntityhubException,
IllegalArgumentException
To only allow create or update operations check first with
isRepresentation(String).
representation - the representation to be updated
EntityhubException - On any error while performing the operation
IllegalArgumentException - if null is parsed as
Representation or if no Representation with the parsed id is
managed by the Entityhub.
Entity delete(String id)
throws EntityhubException,
IllegalArgumentException
setState(String, ManagedEntityState) with
ManagedEntityState.removed as second parameter.
id - The id of the Entity to delete
EntityhubException - On any error while performing the operation
IllegalArgumentException - if null or an empty String
is parsed as id
Entity setState(String id,
ManagedEntityState state)
throws EntityhubException,
IllegalArgumentException
ManagedEntityState as stored with the
metadata of an entity.
id - The id of the Entity (or the metadata of the entity)state - the new state
null if no entity
for the parsed id was found.
EntityhubException - On any error while performing the operation
IllegalArgumentException - if null is parsed as any of
the two parameter or if the parsed id is an empty stringEntityhubConfiguration getConfig()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||