|
Vordel SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vordel.es.EntityStoreDelegate
public class EntityStoreDelegate
Holding area for extended ES functionality which may be candidates for
inclusion into the EntityStore interface proper in the future. Contains
various convenience classes for higher-level manipulation of Entities.
Nested Class Summary | |
---|---|
static class |
EntityStoreDelegate.TypedFieldEntity
Store an Entity which has a field(s)of the specified type and a list of the names of those fields. |
Constructor Summary | |
---|---|
EntityStoreDelegate()
|
Method Summary | |
---|---|
static Entity |
create(EntityStore es,
ESPK parentPK,
java.lang.String type,
java.lang.Object[][] vals)
|
static Entity |
create(EntityStore es,
java.lang.String shk)
|
static Entity |
createDefaultedEntity(EntityStore es,
EntityType type)
Utility to create a new Entity instance with all the default values already set |
static Entity |
createDefaultedEntity(EntityStore es,
java.lang.String type)
|
static byte[] |
exportStore(EntityStore es,
boolean closure,
boolean normalized,
boolean types)
Deprecated. Use the EntityStore.exportContents(java.io.OutputStream, java.util.Collection method instead |
static EntityStoreDelegate.TypedFieldEntity[] |
findEntitiesWithTypedFields(EntityStore es,
java.lang.String fieldType,
java.util.Set<ESPK> selectedKeys)
|
static Entity[] |
findEntity(EntityStore es,
ESPK start,
java.lang.String fieldName,
java.lang.String value,
EntityType type)
Method used to find an entity of a type which contains a field with a certain value Note, use this method carefully as it will recursively get all entities from the entitystore! |
static Entity[] |
findEntity(EntityStore es,
java.lang.String fieldName,
java.lang.String value,
EntityType type)
Method used to find an entity of a type which contains a field with a certain value Note, use this method carefully as it will recursively get all entities from the entitystore! |
static java.util.Collection<ESPK> |
findNamedChildren(EntityStore es,
ESPK parent,
EntityType type,
java.lang.String fieldName,
java.lang.String value)
|
static java.util.Collection<EntityFieldReferences> |
findSoftReferencesToBranch(EntityStore es,
ESPK rootPK)
|
static java.util.Set<ESPK> |
getDescendantPKs(EntityStore es,
ESPK pk,
java.lang.String typeName)
Convenience method to retrieve a set of descendant ESPKs per type |
static Entity |
getEntity(EntityStore es,
ESPK pk)
|
static Entity |
getEntity(EntityStore es,
ESPK currPK,
java.lang.String shorthandKey)
|
static Entity |
getEntity(EntityStore es,
java.lang.String shorthandKey)
Method for getting an Entity for a 'shorthand' key. |
static ESPK |
getEntityForKey(EntityStore es,
ESPK epk)
Locate the entity as specified by the key, in the EntityStore. |
static java.util.SortedSet<Entity> |
getSortedChildEntities(EntityStore es,
ESPK parentPK,
EntityType type)
Intended as a replacement for the SQL 'ORDER BY' construct. |
static java.util.SortedSet<Entity> |
getSortedChildEntities(EntityStore es,
ESPK parentPK,
EntityType type,
java.lang.String[] sortByFields)
Intended as a replacement for the SQL 'ORDER BY' construct. |
static java.util.SortedSet<Entity> |
getSortedChildEntities(EntityStore es,
ESPK parentPK,
EntityType type,
java.lang.String[] sortByFields,
int order)
|
static boolean |
hasType(EntityStore store,
java.lang.String typeName)
Method to determine whether an entity store has a particular type. |
static boolean |
isFederated(java.io.InputStream is)
|
static java.lang.String |
pkToPath(EntityStore es,
ESPK pk)
Convenience method to return the normalized version of the ESPK as an XML fragment. |
static void |
setDefaults(EntityStore es,
Entity entity)
Set any unset fields to have the defaults as set in their type definition |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EntityStoreDelegate()
Method Detail |
---|
public static java.util.Collection<ESPK> findNamedChildren(EntityStore es, ESPK parent, EntityType type, java.lang.String fieldName, java.lang.String value) throws EntityStoreException
EntityStoreException
public static java.util.SortedSet<Entity> getSortedChildEntities(EntityStore es, ESPK parentPK, EntityType type) throws EntityStoreException
Using an iterator on the resulting SortedSet, you're guaranteed that the ordering will be correct.
The ordering rules are that the sequence specified in the key fields array defines the precedence of the fields to sort, so if the keyField[N] matches for one or more entities, then the ordering goes to keyField[N+1] to determine order and so on. If all fields match, then the ESPK of the Entity is used to define order.
In the case of an Entity which has inherited some key field(s) from a
superType, the precedence of the keys is:
superType.key1,..,superType.keyN,subtype.key1,...,subtype.keyN
For an example of this at work, see the test case com.vordel.es.TestEntityComparator
es
- The EntityStore to callparentPK
- The parent node under which to search for Entitiestype
- The type of Entities to search for
EntityStoreException
public static java.util.SortedSet<Entity> getSortedChildEntities(EntityStore es, ESPK parentPK, EntityType type, java.lang.String[] sortByFields) throws EntityStoreException
Using an iterator on the resulting SortedSet, you're guaranteed that the ordering will be correct.
The ordering rules are that the sequence specified in the sortByFields array defines the precedence of the fields to sort, so if the sortByFields[N] match for one or more entities, then the ordering goes to sortByFields[N+1] to determine order and so on. If all fields match, then the ESPK of the Entity is used to define order.
In the case of an Entity which has inherited some key field(s) from a
superType, the precedence of the keys is:
superType.key1,....,superType.keyN,subtype.key1,...,subtype.keyN
For an example of this at work, see the test case com.vordel.es.TestEntityComparator
es
- The EntityStore to callparentPK
- The parent node under which to search for Entitiestype
- The type of Entities to search forsortByFields
- The fields on which to sort the result set
EntityStoreException
java.lang.IllegalArgumentException
- If the specified fields don't match
the specified type definition.public static java.util.SortedSet<Entity> getSortedChildEntities(EntityStore es, ESPK parentPK, EntityType type, java.lang.String[] sortByFields, int order) throws EntityStoreException
EntityStoreException
public static final java.util.Set<ESPK> getDescendantPKs(EntityStore es, ESPK pk, java.lang.String typeName) throws EntityStoreException
EntityStoreException
public static final java.lang.String pkToPath(EntityStore es, ESPK pk)
es
- The EntityStore containing the Entity specifiedpk
- The ESPK of the Entity whose location is to be described. Must
be non-null and not the NULL_ESPK.
public static Entity createDefaultedEntity(EntityStore es, EntityType type) throws EntityStoreException
es
- The EntityStore to connect to to resolve defaulted linkstype
- The type of the entity to create
EntityStoreException
- If there's a problem connecting to the
entity store.public static Entity createDefaultedEntity(EntityStore es, java.lang.String type) throws EntityStoreException
EntityStoreException
public static void setDefaults(EntityStore es, Entity entity) throws EntityStoreException
es
- entity
-
EntityStoreException
public static ESPK getEntityForKey(EntityStore es, ESPK epk)
es
- epk
-
EntityStoreException
public static Entity getEntity(EntityStore es, ESPK pk)
public static final EntityStoreDelegate.TypedFieldEntity[] findEntitiesWithTypedFields(EntityStore es, java.lang.String fieldType, java.util.Set<ESPK> selectedKeys) throws EntityStoreException
EntityStoreException
public static Entity[] findEntity(EntityStore es, java.lang.String fieldName, java.lang.String value, EntityType type) throws EntityStoreException
es
- - the entitystore to searchfieldName
- - the field to be testedvalue
- - the value of fieldName (if null then the value of
fieldName will not be tested)type
- - the type that is being search for (if null then
any type that matches the fieldName value will be returned)
EntityStoreException
public static Entity[] findEntity(EntityStore es, ESPK start, java.lang.String fieldName, java.lang.String value, EntityType type) throws EntityStoreException
es
- - the entitystore to searchstart
- - where to start the searchfieldName
- - the field to be testedvalue
- - the value of fieldName (if null then the value of
fieldName will not be tested)type
- - the type that is being search for (if null then
any type that matches the fieldName value will be returned)
EntityStoreException
public static boolean hasType(EntityStore store, java.lang.String typeName)
store
- typeName
-
public static Entity getEntity(EntityStore es, java.lang.String shorthandKey) throws EntityStoreException
es
- The EntityStore to search.shorthandKey
- A path referencing an Entity in the specified store.
EntityStoreException
ShorthandKeyFinder
public static Entity getEntity(EntityStore es, ESPK currPK, java.lang.String shorthandKey) throws EntityStoreException
EntityStoreException
public static Entity create(EntityStore es, ESPK parentPK, java.lang.String type, java.lang.Object[][] vals) throws EntityStoreException
EntityStoreException
public static Entity create(EntityStore es, java.lang.String shk) throws EntityStoreException
EntityStoreException
public static byte[] exportStore(EntityStore es, boolean closure, boolean normalized, boolean types) throws EntityStoreException
EntityStore.exportContents(java.io.OutputStream, java.util.Collection, int)
method instead
es
- closure
- normalized
- types
-
EntityStoreException
public static boolean isFederated(java.io.InputStream is)
public static java.util.Collection<EntityFieldReferences> findSoftReferencesToBranch(EntityStore es, ESPK rootPK) throws EntityStoreException
EntityStoreException
|
Vordel SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |