com.sun.mdm.index.survivor
Class AbstractSurvivorHelper

java.lang.Object
  extended bycom.sun.mdm.index.survivor.AbstractSurvivorHelper
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
DefaultSurvivorHelper

public abstract class AbstractSurvivorHelper
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Base helper class that provides the following utility methods on omega: get a set of candidate fields that need survivor calculation; get a set of system information fields for each candidate field; and set the value of a candidate field.

See Also:
Serialized Form

Field Summary
protected  java.util.Map mFieldCache
          cache to store system information field metadata for each candidate field Key: candidate field id Value: collection of EPath objects
protected  java.util.Map mStrategyCache
          cache to store the strategy object for each candidate field Key: candidate field id Value: survivor strategy objects
 
Constructor Summary
AbstractSurvivorHelper()
          default constructor
 
Method Summary
 java.lang.Object clone()
          clone the object
 SystemField executeStrategy(java.lang.String candidateField, SystemFieldListMap fields)
          executes the strategy associated with the candidate field
 java.util.Collection getCandidateFieldNames()
          return a list of candidate field names in the SBR
protected  SurvivorStrategyInterface getStrategy(java.lang.String candidateId)
          returns the strategy used for a particular candidate field.
protected  java.util.Collection getSystemFieldMeta(java.lang.String candidateId)
          returns the meta data of system fields for the specified candidiate field
abstract  SystemFieldListMap getSystemFields(EnterpriseObject rec, java.lang.String candidateId)
          returns a mapping of system field values for the candidate field
 void init(SurvivorHelperConfig config)
          initialize the helper using a configuration object
 void setCache(java.util.Map m)
          set the cache
abstract  ObjectNode setCandidateFieldValue(ObjectNode eo, SystemField candidateField)
          sets the candidate field on the omega object using the given value
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mFieldCache

protected java.util.Map mFieldCache
cache to store system information field metadata for each candidate field Key: candidate field id Value: collection of EPath objects


mStrategyCache

protected java.util.Map mStrategyCache
cache to store the strategy object for each candidate field Key: candidate field id Value: survivor strategy objects

Constructor Detail

AbstractSurvivorHelper

public AbstractSurvivorHelper()
default constructor

Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
clone the object

Returns:
clone of the object
Throws:
java.lang.CloneNotSupportedException - clone not supported

executeStrategy

public SystemField executeStrategy(java.lang.String candidateField,
                                   SystemFieldListMap fields)
                            throws SurvivorCalculationException
executes the strategy associated with the candidate field

Parameters:
candidateField - candidate field name
fields - mapping of system id to collection of system field values
Returns:
return the value of the survivor field
Throws:
SurvivorCalculationException - unexpect values

getCandidateFieldNames

public java.util.Collection getCandidateFieldNames()
return a list of candidate field names in the SBR

Returns:
return a list of candidate field names in the SBR

getStrategy

protected SurvivorStrategyInterface getStrategy(java.lang.String candidateId)
returns the strategy used for a particular candidate field. The default strategy is returned if none is specified in the configuration.

Parameters:
candidateId - candidate field
Returns:
returns the strategy used for a particular candidate field. The default strategy is returned if none is specified in the configuration.

getSystemFieldMeta

protected java.util.Collection getSystemFieldMeta(java.lang.String candidateId)
returns the meta data of system fields for the specified candidiate field

Parameters:
candidateId - candidate field name
Returns:
returns the meta data of system fields for the specified candidiate field

getSystemFields

public abstract SystemFieldListMap getSystemFields(EnterpriseObject rec,
                                                   java.lang.String candidateId)
                                            throws SurvivorCalculationException,
                                                   SystemObjectException
returns a mapping of system field values for the candidate field

Parameters:
candidateId - candidate field name
rec - omega object
Returns:
Mapping of system fields using system id as Key. Key: system id Value: collection of SystemField value objects return null if error getting system fields
Throws:
SurvivorCalculationException - unexpected value
SystemObjectException - error accessing entity object

init

public void init(SurvivorHelperConfig config)
          throws StrategyCreationException,
                 HelperCreationException
initialize the helper using a configuration object

Parameters:
config - configuration object
Throws:
StrategyCreationException - exception when creating a survivor calculation strategy
HelperCreationException - error creating the helper class

setCache

public void setCache(java.util.Map m)
set the cache

Parameters:
m - a map

setCandidateFieldValue

public abstract ObjectNode setCandidateFieldValue(ObjectNode eo,
                                                  SystemField candidateField)
                                           throws SurvivorCalculationException,
                                                  SystemObjectException
sets the candidate field on the omega object using the given value

Parameters:
eo - entity object
candidateField - field name and value
Returns:
the Omega object with updated values return null if error setting candidate field value
Throws:
SurvivorCalculationException - unexpected values
SystemObjectException - error accessing entity object


Sun Microsystems, Inc.