Vordel SDK

com.vordel.es
Class Entity

java.lang.Object
  extended by com.vordel.es.impl.AbstractEntity
      extended by com.vordel.es.Entity
All Implemented Interfaces:
com.vordel.common.Dictionary, KeyHolder

public class Entity
extends com.vordel.es.impl.AbstractEntity
implements KeyHolder, com.vordel.common.Dictionary

The main component in the EntityStore. an Entity contains a set of Fields which are accessible by name, as defined in the Entity's relevant EntityType schema.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.vordel.common.Dictionary
com.vordel.common.Dictionary.MapAs
 
Field Summary
static java.lang.String ENV_EXPAND_INDICATOR
          A field containing this substring will be expanded at runtime of the server
protected  EntityType type
          The type of this Entity
 
Fields inherited from class com.vordel.es.impl.AbstractEntity
parentPK, pk
 
Constructor Summary
Entity(EntityType type)
          The constructor for all seasons
 
Method Summary
 Entity cloneEntity()
          Creates a deep copy of the entity, including keys.
 Entity cloneEntityFields()
          Creates a deep copy of the entity, sans keys.
 boolean containsKey(java.lang.String fieldName)
          Check to see if the field has been initialized for the Entity, and that it contains at least one non-null value.
 Entity createCopy()
          Create a copy of this Entity, which will have no PKs set as it is a new 'virgin' Entity.
 java.lang.String describeReference(java.lang.String fieldName)
           
 boolean equals(java.lang.Object obj)
          Returns true if two Entity object are equal.
 boolean equalsContents(Entity other)
          Returns true if the two Entities are of the same type and contain the same field values.
 boolean equalsKeys(Entity other)
           
 java.lang.Object get(java.lang.String name)
          'Dictionary' interface
 Field[] getAllFields()
           
 byte[] getBinaryValue(java.lang.String fieldName)
           
 byte[] getBinaryValue(java.lang.String fieldName, int valueIndex)
           
 boolean getBooleanValue(java.lang.String fieldName)
           
 boolean getBooleanValue(java.lang.String fieldName, int valueIndex)
           
 byte[] getEncryptedValue(java.lang.String fieldName)
           
 byte[] getEncryptedValue(java.lang.String fieldName, int valueIndex)
           
 Field getField(java.lang.String name)
          Get a specific named field
 Field[] getInstanceFields()
          Get all the fields defined in this Entity, excluding the constant field definitions, whose values can be obtained from the type def.
 int getIntegerValue(java.lang.String fieldName)
           
 int getIntegerValue(java.lang.String fieldName, int valueIndex)
           
 java.lang.String getKeyDescription()
          Convenience method to describe this entity in terms of its keys
 java.util.HashMap<java.lang.String,java.lang.Object> getKeyValues()
          Returns the names and values of key fields of the entity
 long getLongValue(java.lang.String fieldName)
           
 long getLongValue(java.lang.String fieldName, int valueIndex)
           
 ESPK getParentPK()
          Get the unique identifier for this Entity's parent Entity
 ESPK getPK()
          Get the unique identifier for this Entity
 java.util.List<Field> getReferenceFields()
           
 java.util.Collection<ESPK> getReferences(java.lang.String fieldName)
          Convenience method to get any references which the named field contains.
 ESPK getReferenceValue(java.lang.String fieldName)
          Convienence method for getting the one single reference value of a reference field.
 java.util.Collection<Field> getReferringFields(ESPK refPK)
           
 java.util.List<Field> getRefFields(boolean onlySoftRefs)
           
 java.util.List<Field> getSoftReferenceFields()
           
 java.lang.String getStringValue(java.lang.String fieldName)
           
 java.lang.String getStringValue(java.lang.String fieldName, int valueIndex)
           
 java.util.Collection<java.lang.String> getStringValues(java.lang.String fieldName)
          Get the string values for the specified field.
 EntityType getType()
          Get the Type of this Entity
 int getValueCount(java.lang.String field)
           
 boolean hasKey()
           
 boolean isConstantField(java.lang.String fName)
           
 boolean keyFieldsDiffer(Entity other)
           
 void removeField(java.lang.String fName)
           
 void setBinaryValue(java.lang.String fieldName, byte[] binary)
          Set the field to have a single value with the binary data supplied
 void setBooleanField(java.lang.String fieldName, boolean val)
           
 void setEncryptedValue(java.lang.String fieldName, byte[] enc)
          Convenience method for setting the encrypted bytes for a field
 void setField(Field f)
          Set a Field for this Entity
 void setField(java.lang.String fName, Value[] vals)
          Convenience method to set the values for a field
 void setFields(java.lang.Object[][] fieldData)
          Convenience method to set multiple single-valued field of various types
 void setIntegerField(java.lang.String fieldName, int val)
           
 void setLongField(java.lang.String fieldName, long val)
           
 Field setMVStringField(java.lang.String fieldName, java.lang.String[] vals)
           
 void setReferenceField(java.lang.String fieldName, ESPK ref)
           
 Field setStringField(java.lang.String fieldName, java.lang.String val)
           
 void setStringFields(java.lang.String[] fieldNames, java.lang.String[] values)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

protected EntityType type
The type of this Entity


ENV_EXPAND_INDICATOR

public static final java.lang.String ENV_EXPAND_INDICATOR
A field containing this substring will be expanded at runtime of the server

See Also:
Constant Field Values
Constructor Detail

Entity

public Entity(EntityType type)
The constructor for all seasons

Parameters:
type - The type of this Entity
Method Detail

cloneEntity

public Entity cloneEntity()
Creates a deep copy of the entity, including keys.


cloneEntityFields

public Entity cloneEntityFields()
Creates a deep copy of the entity, sans keys.


getPK

public ESPK getPK()
Get the unique identifier for this Entity

Specified by:
getPK in interface KeyHolder
Returns:
an ESPK for this Entity

hasKey

public boolean hasKey()

getParentPK

public ESPK getParentPK()
Get the unique identifier for this Entity's parent Entity

Returns:
the parent's ESPK

getType

public EntityType getType()
Get the Type of this Entity

Returns:
the Entity Type

getField

public Field getField(java.lang.String name)
Get a specific named field

Parameters:
name - The name of the field to retrieve
Returns:
A Field for the given name

get

public java.lang.Object get(java.lang.String name)
'Dictionary' interface

Specified by:
get in interface com.vordel.common.Dictionary

setField

public void setField(Field f)
              throws java.lang.IllegalArgumentException
Set a Field for this Entity

Parameters:
f -
Throws:
java.lang.IllegalArgumentException - if the field is a constant field

setField

public void setField(java.lang.String fName,
                     Value[] vals)
              throws EntityStoreException
Convenience method to set the values for a field

Parameters:
fName - The name of the field to set the values for
vals - The values for the field
Throws:
EntityStoreException

removeField

public void removeField(java.lang.String fName)
                 throws EntityStoreException
Throws:
EntityStoreException

getAllFields

public Field[] getAllFields()

isConstantField

public boolean isConstantField(java.lang.String fName)

getInstanceFields

public Field[] getInstanceFields()
Get all the fields defined in this Entity, excluding the constant field definitions, whose values can be obtained from the type def.

Returns:
An array of all Fields for this Entity Instance, excluding constants.

getSoftReferenceFields

public java.util.List<Field> getSoftReferenceFields()

getRefFields

public java.util.List<Field> getRefFields(boolean onlySoftRefs)

getReferenceFields

public java.util.List<Field> getReferenceFields()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getStringValue

public java.lang.String getStringValue(java.lang.String fieldName,
                                       int valueIndex)

getStringValue

public java.lang.String getStringValue(java.lang.String fieldName)

getBinaryValue

public byte[] getBinaryValue(java.lang.String fieldName,
                             int valueIndex)
                      throws EntityStoreException
Throws:
EntityStoreException

getBinaryValue

public byte[] getBinaryValue(java.lang.String fieldName)
                      throws EntityStoreException
Throws:
EntityStoreException

getEncryptedValue

public byte[] getEncryptedValue(java.lang.String fieldName)
                         throws EntityStoreException
Throws:
EntityStoreException

getEncryptedValue

public byte[] getEncryptedValue(java.lang.String fieldName,
                                int valueIndex)
                         throws EntityStoreException
Throws:
EntityStoreException

getIntegerValue

public int getIntegerValue(java.lang.String fieldName,
                           int valueIndex)

getIntegerValue

public int getIntegerValue(java.lang.String fieldName)

getLongValue

public long getLongValue(java.lang.String fieldName,
                         int valueIndex)

getLongValue

public long getLongValue(java.lang.String fieldName)

getBooleanValue

public boolean getBooleanValue(java.lang.String fieldName,
                               int valueIndex)

getBooleanValue

public boolean getBooleanValue(java.lang.String fieldName)

getReferenceValue

public ESPK getReferenceValue(java.lang.String fieldName)
Convienence method for getting the one single reference value of a reference field.

Parameters:
fieldName -
Returns:
The reference value for the field, or ES_NULL_PK if the field is not set.
Throws:
java.lang.IllegalArgumentException - if the field is not of a reference type

getReferences

public java.util.Collection<ESPK> getReferences(java.lang.String fieldName)
Convenience method to get any references which the named field contains.

Parameters:
fieldName -
Returns:
an array of ESPKs for the specified field, or an array containing one ES_NULL_PK if the field isn't set, or is set but has no values.
Throws:
java.lang.IllegalArgumentException - if the field specified is not part of the type definition, or if the field is not of type 'reference'

getValueCount

public int getValueCount(java.lang.String field)

getKeyValues

public java.util.HashMap<java.lang.String,java.lang.Object> getKeyValues()
Returns the names and values of key fields of the entity


setMVStringField

public Field setMVStringField(java.lang.String fieldName,
                              java.lang.String[] vals)
                       throws EntityStoreException
Throws:
EntityStoreException

setLongField

public void setLongField(java.lang.String fieldName,
                         long val)
                  throws EntityStoreException
Throws:
EntityStoreException

setIntegerField

public void setIntegerField(java.lang.String fieldName,
                            int val)
                     throws EntityStoreException
Throws:
EntityStoreException

setBooleanField

public void setBooleanField(java.lang.String fieldName,
                            boolean val)
                     throws EntityStoreException
Throws:
EntityStoreException

setStringField

public Field setStringField(java.lang.String fieldName,
                            java.lang.String val)
                     throws EntityStoreException
Throws:
EntityStoreException

setStringFields

public void setStringFields(java.lang.String[] fieldNames,
                            java.lang.String[] values)
                     throws EntityStoreException
Throws:
EntityStoreException

setBinaryValue

public void setBinaryValue(java.lang.String fieldName,
                           byte[] binary)
                    throws EntityStoreException
Set the field to have a single value with the binary data supplied

Parameters:
fieldName -
binary -
Throws:
EntityStoreException

setEncryptedValue

public void setEncryptedValue(java.lang.String fieldName,
                              byte[] enc)
                       throws EntityStoreException
Convenience method for setting the encrypted bytes for a field

Parameters:
fieldName - The name of the 'encrypted' type field
enc - The encrypted bytes
Throws:
java.lang.IllegalArgumentException - If the field doesn't exist, or isn't of the type 'encrypted' or doesn't have the correct cardinality.
EntityStoreException

setReferenceField

public void setReferenceField(java.lang.String fieldName,
                              ESPK ref)
                       throws EntityStoreException
Throws:
EntityStoreException

equals

public boolean equals(java.lang.Object obj)
Returns true if two Entity object are equal.

Overrides:
equals in class java.lang.Object

equalsContents

public boolean equalsContents(Entity other)
Returns true if the two Entities are of the same type and contain the same field values.

Parameters:
other - The other Entity to compare to
Returns:

equalsKeys

public boolean equalsKeys(Entity other)

createCopy

public Entity createCopy()
Create a copy of this Entity, which will have no PKs set as it is a new 'virgin' Entity. All fields in this Entity will be duplicated in the copy.

Returns:
A new Entity which matches this one.

containsKey

public boolean containsKey(java.lang.String fieldName)
Check to see if the field has been initialized for the Entity, and that it contains at least one non-null value. Implementation of the com.vordel.common.Dictionary interface.

Specified by:
containsKey in interface com.vordel.common.Dictionary

getStringValues

public java.util.Collection<java.lang.String> getStringValues(java.lang.String fieldName)
Get the string values for the specified field.

Parameters:
fieldName - The name of the Field as defined in the EntityType.
Returns:
A collection of 'String' values for the specified field.
Throws:
java.lang.IllegalArgumentException - if the field does not exist, or if it isn't of the string type.

setFields

public void setFields(java.lang.Object[][] fieldData)
               throws EntityStoreException
Convenience method to set multiple single-valued field of various types

Parameters:
fieldData -
Throws:
EntityStoreException

getReferringFields

public java.util.Collection<Field> getReferringFields(ESPK refPK)

describeReference

public java.lang.String describeReference(java.lang.String fieldName)

getKeyDescription

public java.lang.String getKeyDescription()
Convenience method to describe this entity in terms of its keys

Returns:
String describing the keys

keyFieldsDiffer

public boolean keyFieldsDiffer(Entity other)

Vordel SDK


This documentation and all its contents and graphics, copyright © 1999 - 2011 Vordel