com.hcl.voltmx.sync.services.entityframework
Class SyncEntity

java.lang.Object
  extended by com.hcl.voltmx.sync.services.entityframework.SyncEntity
All Implemented Interfaces:
IEntity

public class SyncEntity
extends java.lang.Object
implements IEntity

Weakly typed base class for storing table rows. Main features.

1. Integrated with EFAdapter. Can be directly used to perform CRUD operations

2. Typed metadata

3. Helper relationship functions

4. Helper functions for getting and setting PrimaryKeys.

5. Data parsing functions


Nested Class Summary
static class SyncEntity.ChangeType
          Enumeration type for the change type
 
Field Summary
 java.util.Map<java.lang.String,java.lang.Object> data
           
 SyncEntity parent
           
 java.util.Map<AttributeType,EntityType> parentedTypes
           
 java.util.Map<AttributeType,java.util.List<SyncEntity>> relatedEntites
           
 
Constructor Summary
SyncEntity(EntityType type)
           
 
Method Summary
 void add(PrimaryKey value)
           
 void add(java.lang.String key, java.lang.Object value)
          Adds the attribute name and attribute value
 void addRelatedEntity(AttributeType detailColumn, SyncEntity entity)
           
 void FillData(java.util.Map<java.lang.String,java.lang.Object> data)
           
 SyncEntity.ChangeType getChangeType()
          Returns the change type of the entity.
 java.util.Map<java.lang.String,java.lang.Object> getData()
          Returns the entity data in a map, where keys are the attribute names and values are corresponding attribute values
 java.lang.String getEntityName()
           
 java.lang.Integer GetFieldValueInt(java.lang.String fieldName)
           
 java.lang.Long GetFieldValueLong(java.lang.String fieldName)
           
 java.lang.String getID()
           
 java.lang.Long getIntPk()
           
 java.util.Set<java.lang.String> getKeys()
          Returns the primary key information of the entity
 java.lang.Object getObjectPk()
           
 PrimaryKey getPk()
           
 java.util.List<SyncEntity> getRelated(java.lang.String name)
           
 java.lang.String getServerHashsum()
          Method to calculate Hashsum for actual data columns.
 EntityType getType()
          Returns the EntityType object, which will have the meta information of the entity
 java.lang.String getURI()
           
 java.lang.Object getValue(java.lang.String key)
          Returns the attribute value for a specified attribute
 java.lang.Boolean GetValueAsBoolean(java.lang.String fieldValue)
           
 java.lang.Object GetValueAsObject(java.lang.String fieldValue)
           
 java.lang.String GetValueAsString(java.lang.String fieldValue)
           
 void RemoveField(java.lang.String fieldName)
           
 void setChangeType(SyncEntity.ChangeType changeType)
          Sets the change type of the entity
 void setIntPk(java.lang.Long pk)
           
 void setPk(PrimaryKey value)
           
 void setType(EntityType type)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

public java.util.Map<java.lang.String,java.lang.Object> data

parent

public SyncEntity parent

relatedEntites

public java.util.Map<AttributeType,java.util.List<SyncEntity>> relatedEntites

parentedTypes

public java.util.Map<AttributeType,EntityType> parentedTypes
Constructor Detail

SyncEntity

public SyncEntity(EntityType type)
Method Detail

addRelatedEntity

public void addRelatedEntity(AttributeType detailColumn,
                             SyncEntity entity)

getRelated

public java.util.List<SyncEntity> getRelated(java.lang.String name)

getPk

public PrimaryKey getPk()

getIntPk

public java.lang.Long getIntPk()

getObjectPk

public java.lang.Object getObjectPk()

setIntPk

public void setIntPk(java.lang.Long pk)

setPk

public void setPk(PrimaryKey value)

getEntityName

public java.lang.String getEntityName()

add

public void add(java.lang.String key,
                java.lang.Object value)
Description copied from interface: IEntity
Adds the attribute name and attribute value

Specified by:
add in interface IEntity
Parameters:
key - Attribute Name
value - Attribute Value

add

public void add(PrimaryKey value)

RemoveField

public void RemoveField(java.lang.String fieldName)

FillData

public final void FillData(java.util.Map<java.lang.String,java.lang.Object> data)

GetFieldValueInt

public java.lang.Integer GetFieldValueInt(java.lang.String fieldName)

GetFieldValueLong

public java.lang.Long GetFieldValueLong(java.lang.String fieldName)

GetValueAsObject

public java.lang.Object GetValueAsObject(java.lang.String fieldValue)
                                  throws KeynotfoundException
Throws:
KeynotfoundException

GetValueAsBoolean

public java.lang.Boolean GetValueAsBoolean(java.lang.String fieldValue)

GetValueAsString

public java.lang.String GetValueAsString(java.lang.String fieldValue)

toString

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

setChangeType

public void setChangeType(SyncEntity.ChangeType changeType)
Description copied from interface: IEntity
Sets the change type of the entity

Specified by:
setChangeType in interface IEntity

getChangeType

public SyncEntity.ChangeType getChangeType()
Description copied from interface: IEntity
Returns the change type of the entity.

Specified by:
getChangeType in interface IEntity
Returns:

setType

public void setType(EntityType type)

getType

public EntityType getType()
Description copied from interface: IEntity
Returns the EntityType object, which will have the meta information of the entity

Specified by:
getType in interface IEntity
Returns:
Meta Information of the Entity

getID

public java.lang.String getID()
Specified by:
getID in interface IEntity

getURI

public java.lang.String getURI()
Specified by:
getURI in interface IEntity

getValue

public java.lang.Object getValue(java.lang.String key)
Description copied from interface: IEntity
Returns the attribute value for a specified attribute

Specified by:
getValue in interface IEntity
Parameters:
key - Attribute Name
Returns:
Value of the attribute

getKeys

public java.util.Set<java.lang.String> getKeys()
Description copied from interface: IEntity
Returns the primary key information of the entity

Specified by:
getKeys in interface IEntity
Returns:

getData

public java.util.Map<java.lang.String,java.lang.Object> getData()
Description copied from interface: IEntity
Returns the entity data in a map, where keys are the attribute names and values are corresponding attribute values

Specified by:
getData in interface IEntity
Returns:

getServerHashsum

public java.lang.String getServerHashsum()
Method to calculate Hashsum for actual data columns.

Returns: