org.deduced.dynamic
Class DynamicModelFactory

java.lang.Object
  extended by org.deduced.dynamic.DynamicModelFactory
All Implemented Interfaces:
ModelFactory
Direct Known Subclasses:
FlyWheelTypeBasedControllerFactory

public class DynamicModelFactory
extends java.lang.Object
implements ModelFactory

DynamicModelFactory is a model factory that listens to a schema and dynamically modifies the objects it created to keep them synchronized with the schema.

Author:
Steve McDuff

Nested Class Summary
protected  class DynamicModelFactory.ModelDeleteListener
          Model Delete Listener
protected  class DynamicModelFactory.SchemaListener
          Schema Listener
protected  class DynamicModelFactory.TypeExistenceCheck
          Type Existence Check
 
Field Summary
private  DynamicModelFactory.TypeExistenceCheck check
          type existence check runnable
private  RuleExecutionContextImplementation context
          deduction rule execution context
private  java.util.Map<PropertyCollection<?,?>,java.util.Set<PropertyCollection<?,?>>> createdModelMap
          map between the property collection type and all the models that were created from that type.
private  java.util.Map<PropertyCollection<?,?>,RecursiveModelListener> fullSchemaMap
          map between the list of schema in use and the recursive model listeners that listen to them
private  DynamicModelFactory.ModelDeleteListener modelDeleteListener
          instance of the model listener
private  java.util.Map<PropertyCollection<?,?>,java.util.List<PropertyCollection<?,?>>> reverseDerivedMap
          map containing a list of all the types that have the key-type as a parent.
private  boolean runCheckForTypeExistence
          flag used to indicate if a check for type existence is required
private  PropertyCollection<?,?> schemaBasedApplicationLayer
          collection of type SchemaBasedApplicationLayer.
private  PropertyCollection<?,?> schemaList
          list of schema from the schemaBasedApplicationLayer property
private  DynamicModelFactory.SchemaListener schemaListener
          instance of the schema listener
private static Runner TYPE_EXISTENCE_RUNNER
          runner used to run the check for model types that have been deleted.
 
Constructor Summary
DynamicModelFactory()
          DynamicModelFactory Constructor
 
Method Summary
private  void actionChanged(PropertyChangeEvent<?,?> event)
          action Changed
private  void actionUpdated(PropertyCollection<?,?> action)
          action Updated
private  void addDeductionRule(PropertyCollection<?,?> rule)
          add Deduction Rule
protected  void addDeleteListener(PropertyCollection<?,?> createdCollection)
          add model Delete Listener
private  void addMissingInstances(java.util.List<PropertyCollection<?,?>> affectedModelList, java.util.Map<PropertyCollection<?,?>,PropertyCollection<?,?>> instanceList)
          add Missing Instances
private  void addMissingRules(java.util.List<PropertyCollection<?,?>> affectedModelList, java.util.Map<PropertyCollection<?,?>,PropertyCollection<?,?>> newRuleMap)
          add Missing Rules
private  void addSchema(PropertyCollection<?,?> schema)
          add a Schema
private  void buildCollectionReverseList(PropertyCollection<?,?> collectionType)
          build a collection type reverse derived type list by browsing it's parent list
private  void checkAllTypesToDeleteIfNotInSchema()
          check For All Type Existence
protected  void checkAllTypesToDeleteIfNotInSchemaIfNecessary()
          check to delete all the types that aren't in the schema anymore if necessary
private  void cleanAllParentDerivedTypeList(PropertyCollection<?,?> typeToClean)
          clean Parent Derived Type List recursively by verifying if all the known derived types are still valid to the type to clean, and all the parents it has.
private  void cleanDerivedTypeList(PropertyCollection<?,?> typeToClean)
          clean the Derived Type List of a single property collection type by validating if the known derived types are still inherited.
private  void collectionTypeUpdated(PropertyCollection<?,?> changedType, PropertyChangeEvent<?,?> event)
          collection Type Updated
private  void configureReverseDerivedMap(PropertyCollection<?,?> packageToAdd)
          configure the reverse derived object map by browsing through a package and building the list of derived types.
static java.lang.Object convertValueIfNumericType(PropertyCollection<?,?> type, java.lang.Number newValue)
          create Object If it is a Basic Type
private static java.lang.Object convertValueIfNumericTypePart2(PropertyCollection<?,?> type, java.lang.Number newValue)
          convert Value If Numeric Type Part2
protected  DynamicPropertyMap createDynamicMap(PropertyCollection<?,?> type, boolean activated)
          create Dynamic property Map
private  PropertyCollection<?,?> createDynamicPropertyCollection(PropertyCollection<?,?> type, boolean activated)
          create Dynamic Property Collection
private  PropertyCollection<?,?> createDynamicPropertyList()
          create Dynamic Property List
private  boolean createListIfValidDestroyOtherwise(PropertyCollection<?,?> changedInstance)
          create List If Valid Destroy Otherwise
 PropertyCollection<?,?> createModel(PropertyCollection<?,?> type)
          (non-Javadoc)
 PropertyCollection<?,?> createModel(PropertyCollection<?,?> type, boolean activated)
          (non-Javadoc)
private  void deductionRuleChanged(PropertyChangeEvent<?,?> event)
          deduction rule Changed
private  void deductionRuleListChanged(PropertyChangeEvent<?,?> event)
          deduction Rule List Changed
private  void deductionRuleUpdated(PropertyCollection<?,?> rule)
          deduction rule updated
private  void deleteAllCreatedModelsInPackage(PropertyCollection<?,?> packageToRemove)
          delete All Created Models In Package
private  void deleteAllCreatedModelsOfType(PropertyCollection<?,?> currentType)
          delete All Created Models Of Type
private  void deleteInstance(PropertyCollection<?,?> changedType, PropertyCollection<?,?> oldInstance)
          delete Instance
private  void deleteTypeIfNotInSchema(PropertyCollection<?,?> type)
          delete Type If Not In Schema
private  void enumerationTypeChanged(PropertyCollection<?,?> changedEnumerationType, PropertyChangeEvent<?,?> event)
          enumeration Type Changed
private  PropertyCollection<?,?> getActionFromModel(PropertyCollection<?,?> model)
          get action From Model by iterating through the parent list until we hit an action
private  java.util.List<PropertyCollection<?,?>> getAllModelsOfType(PropertyCollection<?,?> changedType)
          get a list of All the Models Of a specified Type, including those that are derived from the type.
 RuleExecutionContext getContext()
          get the deduction rule execution context
private  java.lang.Object getConvertedBasicValue(PropertyCollection<?,?> changedInstance, PropertyCollection<?,?> newValueType, java.lang.Object propertyValue, PropertyCollection<?,?> changedCollection)
          get Converted Basic Value
private  java.util.Set<PropertyCollection<?,?>> getCreatedModelSet(PropertyCollection<?,?> type, boolean createIfNecessary, boolean canReturnNull)
          get the list of all the created models of a specific type
protected  java.util.List<PropertyCollection<?,?>> getDerivedModelList(PropertyCollection<?,?> type)
          get the list of all the derived types from the specified type.
static java.util.Map<PropertyCollection<?,?>,PropertyCollection<?,?>> getInstanceListFromTypeList(java.util.Collection<PropertyCollection<?,?>> typeList)
          get Instance List From Type List
private  PropertyCollection<?,?> getRuleFromModel(PropertyCollection<?,?> model)
          get Rule From Model by iterating through the parent list until we hit a deduction rule
static java.util.Map<PropertyCollection<?,?>,PropertyCollection<?,?>> getRuleListFromTypeList(java.util.Collection<PropertyCollection<?,?>> typeList)
          get the rule List From Type List
 PropertyCollection<?,?> getSchemaBasedApplicationLayer()
          get Schema Based Application Layer
private  PropertyCollection<?,?> getSchemaList()
          get the Schema List
static Runner getTypeExistenceRunner()
           
private static PropertyCollection<?,?> getTypeFromModel(PropertyCollection<?,?> collection)
          get Type From Model by browsing the list of parents until we hit a property collection type
protected  void initializeCollection(PropertyCollection<?,?> createdCollection)
          initialize Collection
private  void instanceChanged(PropertyCollection<?,?> changedInstance, PropertyChangeEvent<?,?> event)
          instance Changed
private  void instanceListChanged(PropertyChangeEvent<?,?> event)
          property collection type instance List Changed
private  void instanceReferenceChanged(PropertyCollection<?,?> changedInstance, PropertyChangeEvent<?,?> event, PropertyCollection<?,?> changedType)
          instance reference flag Changed
private  void instanceReferenceChangedOnCollection(boolean deleteValues, java.lang.Object key, DynamicPropertyMap dynamicMap, PropertyCollection<?,?> changedInstance)
          instance Reference Changed On Collection.
private  void instanceTypeChanged(PropertyCollection<?,?> changedInstance, PropertyChangeEvent<?,?> event, PropertyCollection<?,?> changedType)
          instance Type Changed
static boolean isPropertyCollectionListInstanceValid(PropertyCollection<?,?> instanceToValidate)
          is Property Collection List Instance Valid
static boolean isPropertyInstanceValid(PropertyCollection<?,?> changedInstance)
          check if a property instance is valid
private  boolean isTypeInSchema(PropertyCollection<?,?> type)
          is Type In Schema
private  void listFixedInstanceChanged(PropertyCollection<?,?> changedInstance, PropertyChangeEvent<?,?> event)
          list Fixed Instance Changed
private  void listInSchemaChanged(PropertyChangeEvent<?,?> event)
          schema list Changed
private  void listInstanceChanged(PropertyCollection<?,?> changedInstance, PropertyChangeEvent<?,?> event)
          list Instance Changed
protected  void modelChanged(PropertyChangeEvent<?,?> event)
          model changed
private  void parentListChanged(PropertyChangeEvent<?,?> event)
          parent List Changed
private  void propertyInstanceChanged(PropertyChangeEvent<?,?> event)
          property Instance Changed
private  void propertyPackageChanged(PropertyChangeEvent<?,?> event)
          property Package Changed
private  void propertyPackageListChanged(PropertyChangeEvent<?,?> event)
          property Package List Changed
private  void propertyTypeListChanged(PropertyChangeEvent<?,?> event)
          property Type List Changed
private  void rebuildInstance(PropertyCollection<?,?> changedType, PropertyCollection<?,?> newInstance)
          rebuild a property instance
private  void recursiveAddAllParentList(PropertyCollection<?,?> childCollection, PropertyCollection<?,?> currentParent)
          browse all the parents of a parent collection and add a child collection to it's derived list
private  void recursiveAddToParentList(PropertyCollection<?,?> childCollection, PropertyCollection<?,?> currentParent)
          recursively add a type to it's parent derived model list
protected  void registerCreatedCollection(PropertyCollection<?,?> createdCollection)
          register Created Collection
 void removeAllObsoleteInstancesAndRulesFromRemovedParent(PropertyCollection<?,?> changedType, PropertyCollection<?,?> removedParent)
          remove All Obsolete Instances and rules From Removed Parent
private  void removeDeductionRule(PropertyCollection<?,?> rule)
          remove Deduction Rule
private  void removeDeductionRule(PropertyCollection<?,?> rule, PropertyCollection<?,?> type)
          remove Deduction Rule
 void removeObsoleteInstancesOnTypeFromRemovedParent(PropertyCollection<?,?> type, java.util.Map<PropertyCollection<?,?>,PropertyCollection<?,?>> currentInstanceList, java.util.Map<PropertyCollection<?,?>,PropertyCollection<?,?>> removedParentInstanceMap)
          remove Obsolete Instances On Type From Removed Parent
 void removeObsoleteRulesOnTypeFromRemovedParent(PropertyCollection<?,?> type, java.util.Map<PropertyCollection<?,?>,PropertyCollection<?,?>> currentRuleList, java.util.Map<PropertyCollection<?,?>,PropertyCollection<?,?>> removedParentRuleMap)
          remove Obsolete Rules On Type From Removed Parent
private  void removeSchema(PropertyCollection<?,?> schema)
          remove a Schema
private  void removeSchemaIfNotInList(PropertyCollection<?,?> schema)
          remove a Schema if it's not in the list anymore
private  void resetAllListFixedInstance(PropertyCollection<?,?> changedInstance)
          reset All List Fixed Instance on the models that contain the instance
private  void resetListFixedInstance(PropertyCollection<?,?> changedInstance, PropertyList<DynamicPropertyMap> currentList)
          reset List Fixed Instance
private  void resetListMemberFixedInstance(PropertyList<DynamicPropertyMap> currentList, PropertyCollection<?,?> listFixedInstanceType, boolean fixedInstanceIsReference, java.util.List<DynamicPropertyMap> objectAddList, java.lang.Object currentKey)
          reset List Member Fixed Instance
private  void revalidateAllInstancesOfType(PropertyCollection<?,?> previousParent)
          after a property collection type isn't a parent of another type anymore, it is possible that some properties that pointed to a type in the parent hierarchy aren't valid anymore.
private  void runTypeExistenceCheckLater()
          run Type Existence Check Later
private  void schemaAddParentLinkEvent(PropertyChangeEvent<?,?> event)
          schema Add Parent Link Event
private  void schemaBasedApplicationLayerChanged(PropertyChangeEvent<?,?> event)
          schema Based Application Layer Changed
protected  void schemaChanged(PropertyChangeEvent<?,?> event)
          schema Changed
private  void schemaInstanceRemovedEvent(PropertyChangeEvent<?,?> event)
          schema Instance Removed Event
private  void schemaLayerChanged(PropertyChangeEvent<?,?> event)
          schema Layer Changed
private  void schemaListChanged(PropertyChangeEvent<?,?> event)
          schema List Changed
private  void schemaNewInstanceAddedEvent(PropertyChangeEvent<?,?> event)
          schema New Instance Added Event
private  void schemaObjectChanged(PropertyChangeEvent<?,?> event, PropertyCollection<?,?> collection, PropertyCollection<?,?> type)
          schema Object Changed
private  void schemaObjectChanged2(PropertyChangeEvent<?,?> event, PropertyCollection<?,?> type)
          schema Object Changed2 used to breakdown the previous method to lower it's complexity.
private  void schemaRemoveParentLinkEvent(PropertyChangeEvent<?,?> event)
          schema Remove Parent Link Event
protected static void setPropertyValueOnDynamicMap(java.lang.Object key, PropertyCollection<java.lang.Object,java.lang.Object> dynamicMap, java.lang.Object newValue)
          set Property Value On Dynamic Map
 void setSchemaBasedApplicationLayer(PropertyCollection<?,?> layer)
          set Schema Based Application Layer
static void setTypeExistenceRunner(Runner setTypeExistenceRunner)
           
private  void typeChanged(PropertyCollection<?,?> changedType, PropertyChangeEvent<?,?> event)
          type Changed
private  void typeDeleted(PropertyCollection<?,?> deletedType)
          collection Type deleted
private  void updateInstanceValueWithNewCollectionType(PropertyCollection<?,?> changedInstance, PropertyCollection<?,?> changedType, java.lang.Object key, PropertyCollection<?,?> newValueType)
          update Instance Value With New Collection Type
private  void updateInstanceWithNewTypeOnCollection(PropertyCollection<?,?> changedInstance, java.lang.Object key, PropertyCollection<?,?> newValueType, DynamicPropertyMap dynamicMap)
          update Instance With New Type On Collection
private  void updateSchemaList()
          update Schema List
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_EXISTENCE_RUNNER

private static Runner TYPE_EXISTENCE_RUNNER
runner used to run the check for model types that have been deleted.


schemaListener

private DynamicModelFactory.SchemaListener schemaListener
instance of the schema listener


modelDeleteListener

private DynamicModelFactory.ModelDeleteListener modelDeleteListener
instance of the model listener


fullSchemaMap

private java.util.Map<PropertyCollection<?,?>,RecursiveModelListener> fullSchemaMap
map between the list of schema in use and the recursive model listeners that listen to them


createdModelMap

private java.util.Map<PropertyCollection<?,?>,java.util.Set<PropertyCollection<?,?>>> createdModelMap
map between the property collection type and all the models that were created from that type.


reverseDerivedMap

private java.util.Map<PropertyCollection<?,?>,java.util.List<PropertyCollection<?,?>>> reverseDerivedMap
map containing a list of all the types that have the key-type as a parent.


context

private RuleExecutionContextImplementation context
deduction rule execution context


schemaBasedApplicationLayer

private PropertyCollection<?,?> schemaBasedApplicationLayer
collection of type SchemaBasedApplicationLayer. Used to listen to the list of schema being used.


schemaList

private PropertyCollection<?,?> schemaList
list of schema from the schemaBasedApplicationLayer property


runCheckForTypeExistence

private boolean runCheckForTypeExistence
flag used to indicate if a check for type existence is required


check

private DynamicModelFactory.TypeExistenceCheck check
type existence check runnable

Constructor Detail

DynamicModelFactory

public DynamicModelFactory()
DynamicModelFactory Constructor

Method Detail

runTypeExistenceCheckLater

private void runTypeExistenceCheckLater()
run Type Existence Check Later


checkAllTypesToDeleteIfNotInSchemaIfNecessary

protected void checkAllTypesToDeleteIfNotInSchemaIfNecessary()
check to delete all the types that aren't in the schema anymore if necessary


checkAllTypesToDeleteIfNotInSchema

private void checkAllTypesToDeleteIfNotInSchema()
check For All Type Existence


deleteTypeIfNotInSchema

private void deleteTypeIfNotInSchema(PropertyCollection<?,?> type)
delete Type If Not In Schema

Parameters:
type - the type to verify

isTypeInSchema

private boolean isTypeInSchema(PropertyCollection<?,?> type)
is Type In Schema

Parameters:
type - the type to search for
Returns:
true if the type is in the schema

configureReverseDerivedMap

private void configureReverseDerivedMap(PropertyCollection<?,?> packageToAdd)
configure the reverse derived object map by browsing through a package and building the list of derived types.

Parameters:
packageToAdd - the package to add

buildCollectionReverseList

private void buildCollectionReverseList(PropertyCollection<?,?> collectionType)
build a collection type reverse derived type list by browsing it's parent list

Parameters:
collectionType - the type to build.

recursiveAddToParentList

private void recursiveAddToParentList(PropertyCollection<?,?> childCollection,
                                      PropertyCollection<?,?> currentParent)
recursively add a type to it's parent derived model list

Parameters:
childCollection - the type to add
currentParent - the current parent of the type

recursiveAddAllParentList

private void recursiveAddAllParentList(PropertyCollection<?,?> childCollection,
                                       PropertyCollection<?,?> currentParent)
browse all the parents of a parent collection and add a child collection to it's derived list

Parameters:
childCollection - the child collection type to add as a derived type to all it's parents.
currentParent - the current parent on which to add the derived type.

getDerivedModelList

protected java.util.List<PropertyCollection<?,?>> getDerivedModelList(PropertyCollection<?,?> type)
get the list of all the derived types from the specified type.

Parameters:
type - the type from which to get all the derived types
Returns:
the derived type list

deleteAllCreatedModelsInPackage

private void deleteAllCreatedModelsInPackage(PropertyCollection<?,?> packageToRemove)
delete All Created Models In Package

Parameters:
packageToRemove - the package to remove

deleteAllCreatedModelsOfType

private void deleteAllCreatedModelsOfType(PropertyCollection<?,?> currentType)
delete All Created Models Of Type

Parameters:
currentType - the type to delete

createModel

public PropertyCollection<?,?> createModel(PropertyCollection<?,?> type)
(non-Javadoc)

Specified by:
createModel in interface ModelFactory
Parameters:
type - the type of model to create
Returns:
the created model
See Also:
ModelFactory.createModel(org.deduced.PropertyCollection)

createModel

public PropertyCollection<?,?> createModel(PropertyCollection<?,?> type,
                                           boolean activated)
(non-Javadoc)

Specified by:
createModel in interface ModelFactory
Parameters:
type - type of collection to create
activated - is activated or not
Returns:
the created collection.
See Also:
ModelFactory.createModel(org.deduced.PropertyCollection, boolean)

createDynamicPropertyCollection

private PropertyCollection<?,?> createDynamicPropertyCollection(PropertyCollection<?,?> type,
                                                                boolean activated)
create Dynamic Property Collection

Parameters:
type - type to create
activated - is the collection activated
Returns:
the created collection

initializeCollection

protected final void initializeCollection(PropertyCollection<?,?> createdCollection)
initialize Collection

Parameters:
createdCollection - the collection to initialize

getContext

public RuleExecutionContext getContext()
get the deduction rule execution context

Returns:
the rule execution context

registerCreatedCollection

protected final void registerCreatedCollection(PropertyCollection<?,?> createdCollection)
register Created Collection

Parameters:
createdCollection - the collection to register

addDeleteListener

protected final void addDeleteListener(PropertyCollection<?,?> createdCollection)
add model Delete Listener

Parameters:
createdCollection - the model to listen to

createDynamicMap

protected DynamicPropertyMap createDynamicMap(PropertyCollection<?,?> type,
                                              boolean activated)
create Dynamic property Map

Parameters:
type - the type to create
activated - is the collection activated
Returns:
the created collection

createDynamicPropertyList

private PropertyCollection<?,?> createDynamicPropertyList()
create Dynamic Property List

Returns:
the created list

getCreatedModelSet

private java.util.Set<PropertyCollection<?,?>> getCreatedModelSet(PropertyCollection<?,?> type,
                                                                  boolean createIfNecessary,
                                                                  boolean canReturnNull)
get the list of all the created models of a specific type

Parameters:
type - the type of model to look for
createIfNecessary - option to create the model list if it doesn't exist yet
canReturnNull - option to allow the return of a null value. If set to false and the model list doesn't exist and the createIfNecessary flag is set to false, this method will throw an exception.
Returns:
the create model set of the specified type

modelChanged

protected void modelChanged(PropertyChangeEvent<?,?> event)
model changed

Parameters:
event - the event that changed

schemaChanged

protected void schemaChanged(PropertyChangeEvent<?,?> event)
schema Changed

Parameters:
event - the event that describes the change

schemaObjectChanged

private void schemaObjectChanged(PropertyChangeEvent<?,?> event,
                                 PropertyCollection<?,?> collection,
                                 PropertyCollection<?,?> type)
schema Object Changed

Parameters:
event - the change event
collection - the collection that changed
type - the collection type that changed

schemaObjectChanged2

private void schemaObjectChanged2(PropertyChangeEvent<?,?> event,
                                  PropertyCollection<?,?> type)
schema Object Changed2 used to breakdown the previous method to lower it's complexity.

Parameters:
event - change event
type - change type

propertyPackageChanged

private void propertyPackageChanged(PropertyChangeEvent<?,?> event)
property Package Changed

Parameters:
event - event that occurred

propertyInstanceChanged

private void propertyInstanceChanged(PropertyChangeEvent<?,?> event)
property Instance Changed

Parameters:
event - the change event

schemaListChanged

private void schemaListChanged(PropertyChangeEvent<?,?> event)
schema List Changed

Parameters:
event - the change event

schemaBasedApplicationLayerChanged

private void schemaBasedApplicationLayerChanged(PropertyChangeEvent<?,?> event)
schema Based Application Layer Changed

Parameters:
event - the change event

schemaLayerChanged

private void schemaLayerChanged(PropertyChangeEvent<?,?> event)
schema Layer Changed

Parameters:
event - the change event

deductionRuleChanged

private void deductionRuleChanged(PropertyChangeEvent<?,?> event)
deduction rule Changed

Parameters:
event - event describing the change

actionChanged

private void actionChanged(PropertyChangeEvent<?,?> event)
action Changed

Parameters:
event - event describing the change

deductionRuleUpdated

private void deductionRuleUpdated(PropertyCollection<?,?> rule)
deduction rule updated

Parameters:
rule - rule that was updated

actionUpdated

private void actionUpdated(PropertyCollection<?,?> action)
action Updated

Parameters:
action - action that was updated

removeDeductionRule

private void removeDeductionRule(PropertyCollection<?,?> rule)
remove Deduction Rule

Parameters:
rule - rule to remove

removeDeductionRule

private void removeDeductionRule(PropertyCollection<?,?> rule,
                                 PropertyCollection<?,?> type)
remove Deduction Rule

Parameters:
rule - rule to remove
type - type that contains the rule

addDeductionRule

private void addDeductionRule(PropertyCollection<?,?> rule)
add Deduction Rule

Parameters:
rule - rule to add

getRuleFromModel

private PropertyCollection<?,?> getRuleFromModel(PropertyCollection<?,?> model)
get Rule From Model by iterating through the parent list until we hit a deduction rule

Parameters:
model - the model from which to start searching
Returns:
the identified deduction rule

getActionFromModel

private PropertyCollection<?,?> getActionFromModel(PropertyCollection<?,?> model)
get action From Model by iterating through the parent list until we hit an action

Parameters:
model - the model from which to start searching
Returns:
the identified action

enumerationTypeChanged

private void enumerationTypeChanged(PropertyCollection<?,?> changedEnumerationType,
                                    PropertyChangeEvent<?,?> event)
enumeration Type Changed

Parameters:
changedEnumerationType - the type that changed
event - description of the event

listInSchemaChanged

private void listInSchemaChanged(PropertyChangeEvent<?,?> event)
schema list Changed

Parameters:
event - description of the event

deductionRuleListChanged

private void deductionRuleListChanged(PropertyChangeEvent<?,?> event)
deduction Rule List Changed

Parameters:
event - the change event

propertyTypeListChanged

private void propertyTypeListChanged(PropertyChangeEvent<?,?> event)
property Type List Changed

Parameters:
event - the change event

propertyPackageListChanged

private void propertyPackageListChanged(PropertyChangeEvent<?,?> event)
property Package List Changed

Parameters:
event - the change event

getTypeFromModel

private static PropertyCollection<?,?> getTypeFromModel(PropertyCollection<?,?> collection)
get Type From Model by browsing the list of parents until we hit a property collection type

Parameters:
collection - the model to search from
Returns:
the parent property collection type

parentListChanged

private void parentListChanged(PropertyChangeEvent<?,?> event)
parent List Changed

Parameters:
event - description of the change event

schemaAddParentLinkEvent

private void schemaAddParentLinkEvent(PropertyChangeEvent<?,?> event)
schema Add Parent Link Event

Parameters:
event - description of the change event

addMissingRules

private void addMissingRules(java.util.List<PropertyCollection<?,?>> affectedModelList,
                             java.util.Map<PropertyCollection<?,?>,PropertyCollection<?,?>> newRuleMap)
add Missing Rules

Parameters:
affectedModelList - the list of affected models
newRuleMap - the list of rules to create

schemaRemoveParentLinkEvent

private void schemaRemoveParentLinkEvent(PropertyChangeEvent<?,?> event)
schema Remove Parent Link Event

Parameters:
event - description of the change event

removeAllObsoleteInstancesAndRulesFromRemovedParent

public void removeAllObsoleteInstancesAndRulesFromRemovedParent(PropertyCollection<?,?> changedType,
                                                                PropertyCollection<?,?> removedParent)
remove All Obsolete Instances and rules From Removed Parent

Parameters:
changedType - the type that changed
removedParent - the parent that was removed

removeObsoleteInstancesOnTypeFromRemovedParent

public void removeObsoleteInstancesOnTypeFromRemovedParent(PropertyCollection<?,?> type,
                                                           java.util.Map<PropertyCollection<?,?>,PropertyCollection<?,?>> currentInstanceList,
                                                           java.util.Map<PropertyCollection<?,?>,PropertyCollection<?,?>> removedParentInstanceMap)
remove Obsolete Instances On Type From Removed Parent

Parameters:
type - the type that changed
currentInstanceList - the current instance list on the type
removedParentInstanceMap - the potentially removed instances

removeObsoleteRulesOnTypeFromRemovedParent

public void removeObsoleteRulesOnTypeFromRemovedParent(PropertyCollection<?,?> type,
                                                       java.util.Map<PropertyCollection<?,?>,PropertyCollection<?,?>> currentRuleList,
                                                       java.util.Map<PropertyCollection<?,?>,PropertyCollection<?,?>> removedParentRuleMap)
remove Obsolete Rules On Type From Removed Parent

Parameters:
type - the type that changed
currentRuleList - the current rule list on the type
removedParentRuleMap - the potentially removed rules

cleanAllParentDerivedTypeList

private void cleanAllParentDerivedTypeList(PropertyCollection<?,?> typeToClean)
clean Parent Derived Type List recursively by verifying if all the known derived types are still valid to the type to clean, and all the parents it has.

Parameters:
typeToClean - the collection type to clean

cleanDerivedTypeList

private void cleanDerivedTypeList(PropertyCollection<?,?> typeToClean)
clean the Derived Type List of a single property collection type by validating if the known derived types are still inherited.

Parameters:
typeToClean - the type to clean.

revalidateAllInstancesOfType

private void revalidateAllInstancesOfType(PropertyCollection<?,?> previousParent)
after a property collection type isn't a parent of another type anymore, it is possible that some properties that pointed to a type in the parent hierarchy aren't valid anymore.

Parameters:
previousParent - the parent that got removed from a hierarchy

getAllModelsOfType

private java.util.List<PropertyCollection<?,?>> getAllModelsOfType(PropertyCollection<?,?> changedType)
get a list of All the Models Of a specified Type, including those that are derived from the type.

Parameters:
changedType - the type that changed
Returns:
the list of models of the specified type

addMissingInstances

private void addMissingInstances(java.util.List<PropertyCollection<?,?>> affectedModelList,
                                 java.util.Map<PropertyCollection<?,?>,PropertyCollection<?,?>> instanceList)
add Missing Instances

Parameters:
affectedModelList - the list of affected models
instanceList - a map of all the property instances for both key and values

typeChanged

private void typeChanged(PropertyCollection<?,?> changedType,
                         PropertyChangeEvent<?,?> event)
type Changed

Parameters:
changedType - the type that changed
event - description of the change event

collectionTypeUpdated

private void collectionTypeUpdated(PropertyCollection<?,?> changedType,
                                   PropertyChangeEvent<?,?> event)
collection Type Updated

Parameters:
changedType - the type that changed
event - description of the change event

typeDeleted

private void typeDeleted(PropertyCollection<?,?> deletedType)
collection Type deleted

Parameters:
deletedType - the type that was deleted

getInstanceListFromTypeList

public static java.util.Map<PropertyCollection<?,?>,PropertyCollection<?,?>> getInstanceListFromTypeList(java.util.Collection<PropertyCollection<?,?>> typeList)
get Instance List From Type List

Parameters:
typeList - the type list
Returns:
the list of instances in those types

getRuleListFromTypeList

public static java.util.Map<PropertyCollection<?,?>,PropertyCollection<?,?>> getRuleListFromTypeList(java.util.Collection<PropertyCollection<?,?>> typeList)
get the rule List From Type List

Parameters:
typeList - the type list
Returns:
the list of rules in those types

instanceListChanged

private void instanceListChanged(PropertyChangeEvent<?,?> event)
property collection type instance List Changed

Parameters:
event - description of the change

schemaInstanceRemovedEvent

private void schemaInstanceRemovedEvent(PropertyChangeEvent<?,?> event)
schema Instance Removed Event

Parameters:
event - description of the change

deleteInstance

private void deleteInstance(PropertyCollection<?,?> changedType,
                            PropertyCollection<?,?> oldInstance)
delete Instance

Parameters:
changedType - the type that changed
oldInstance - the instance that was removed

schemaNewInstanceAddedEvent

private void schemaNewInstanceAddedEvent(PropertyChangeEvent<?,?> event)
schema New Instance Added Event

Parameters:
event - description of the change

rebuildInstance

private void rebuildInstance(PropertyCollection<?,?> changedType,
                             PropertyCollection<?,?> newInstance)
rebuild a property instance

Parameters:
changedType - the type that changed
newInstance - the instance to rebuild

instanceChanged

private void instanceChanged(PropertyCollection<?,?> changedInstance,
                             PropertyChangeEvent<?,?> event)
instance Changed

Parameters:
changedInstance - the changed instance
event - description of the change event

instanceReferenceChanged

private void instanceReferenceChanged(PropertyCollection<?,?> changedInstance,
                                      PropertyChangeEvent<?,?> event,
                                      PropertyCollection<?,?> changedType)
instance reference flag Changed

Parameters:
changedInstance - the changed instance
event - description of the change event
changedType - the type that contains the changed instance

instanceReferenceChangedOnCollection

private void instanceReferenceChangedOnCollection(boolean deleteValues,
                                                  java.lang.Object key,
                                                  DynamicPropertyMap dynamicMap,
                                                  PropertyCollection<?,?> changedInstance)
instance Reference Changed On Collection.

Parameters:
deleteValues - option to delete all the values that were previously contained by this instance if they are property collections.
key - the changed instance key
dynamicMap - the collection to change
changedInstance - the instance that changed

instanceTypeChanged

private void instanceTypeChanged(PropertyCollection<?,?> changedInstance,
                                 PropertyChangeEvent<?,?> event,
                                 PropertyCollection<?,?> changedType)
instance Type Changed

Parameters:
changedInstance - the changed instance
event - description of the event
changedType - the type that contains the changed instance

updateInstanceValueWithNewCollectionType

private void updateInstanceValueWithNewCollectionType(PropertyCollection<?,?> changedInstance,
                                                      PropertyCollection<?,?> changedType,
                                                      java.lang.Object key,
                                                      PropertyCollection<?,?> newValueType)
update Instance Value With New Collection Type

Parameters:
changedInstance - the changed instance
changedType - the type that contains the changed instance
key - the key of the property
newValueType - the new value type

updateInstanceWithNewTypeOnCollection

private void updateInstanceWithNewTypeOnCollection(PropertyCollection<?,?> changedInstance,
                                                   java.lang.Object key,
                                                   PropertyCollection<?,?> newValueType,
                                                   DynamicPropertyMap dynamicMap)
update Instance With New Type On Collection

Parameters:
changedInstance - the changed instance
key - the instance key
newValueType - the new value type
dynamicMap - the map that might change

getConvertedBasicValue

private java.lang.Object getConvertedBasicValue(PropertyCollection<?,?> changedInstance,
                                                PropertyCollection<?,?> newValueType,
                                                java.lang.Object propertyValue,
                                                PropertyCollection<?,?> changedCollection)
get Converted Basic Value

Parameters:
changedInstance - the instance that changed
newValueType - the new value type to match
propertyValue - the current property value matching the old type
changedCollection - the changed collection
Returns:
the new value matching the new type

convertValueIfNumericType

public static java.lang.Object convertValueIfNumericType(PropertyCollection<?,?> type,
                                                         java.lang.Number newValue)
create Object If it is a Basic Type

Parameters:
type - the type to create
newValue - the new converted numeric value
Returns:
the created object. Null if we were unable to create it.

convertValueIfNumericTypePart2

private static java.lang.Object convertValueIfNumericTypePart2(PropertyCollection<?,?> type,
                                                               java.lang.Number newValue)
convert Value If Numeric Type Part2

Parameters:
type - the type to convert
newValue - the number value
Returns:
the converted object

isPropertyInstanceValid

public static boolean isPropertyInstanceValid(PropertyCollection<?,?> changedInstance)
check if a property instance is valid

Parameters:
changedInstance - the property instance to check
Returns:
true if the instance is valid

listFixedInstanceChanged

private void listFixedInstanceChanged(PropertyCollection<?,?> changedInstance,
                                      PropertyChangeEvent<?,?> event)
list Fixed Instance Changed

Parameters:
changedInstance - the changed instance
event - description of the change event

setPropertyValueOnDynamicMap

protected static void setPropertyValueOnDynamicMap(java.lang.Object key,
                                                   PropertyCollection<java.lang.Object,java.lang.Object> dynamicMap,
                                                   java.lang.Object newValue)
set Property Value On Dynamic Map

Parameters:
key - the key of the property to change
dynamicMap - the dynamic map to change
newValue - the new value

listInstanceChanged

private void listInstanceChanged(PropertyCollection<?,?> changedInstance,
                                 PropertyChangeEvent<?,?> event)
list Instance Changed

Parameters:
changedInstance - the changed list instance
event - description of the change event

resetAllListFixedInstance

private void resetAllListFixedInstance(PropertyCollection<?,?> changedInstance)
reset All List Fixed Instance on the models that contain the instance

Parameters:
changedInstance - the changed list instance

resetListFixedInstance

private void resetListFixedInstance(PropertyCollection<?,?> changedInstance,
                                    PropertyList<DynamicPropertyMap> currentList)
reset List Fixed Instance

Parameters:
changedInstance - the changed instance
currentList - the current list to change

resetListMemberFixedInstance

private void resetListMemberFixedInstance(PropertyList<DynamicPropertyMap> currentList,
                                          PropertyCollection<?,?> listFixedInstanceType,
                                          boolean fixedInstanceIsReference,
                                          java.util.List<DynamicPropertyMap> objectAddList,
                                          java.lang.Object currentKey)
reset List Member Fixed Instance

Parameters:
currentList - the list to change
listFixedInstanceType - the list fixed instance type
fixedInstanceIsReference - is the fixed instance a reference
objectAddList - the list of values to add back to the modified list after everything is removed.
currentKey - current key being modified

createListIfValidDestroyOtherwise

private boolean createListIfValidDestroyOtherwise(PropertyCollection<?,?> changedInstance)
create List If Valid Destroy Otherwise

Parameters:
changedInstance - the changed instance
Returns:
true if the instance is valid

isPropertyCollectionListInstanceValid

public static boolean isPropertyCollectionListInstanceValid(PropertyCollection<?,?> instanceToValidate)
is Property Collection List Instance Valid

Parameters:
instanceToValidate - the instance to validate
Returns:
true if the instance is valid

addSchema

private void addSchema(PropertyCollection<?,?> schema)
add a Schema

Parameters:
schema - the schema to add

removeSchemaIfNotInList

private void removeSchemaIfNotInList(PropertyCollection<?,?> schema)
remove a Schema if it's not in the list anymore

Parameters:
schema - the schema to possibly remove

removeSchema

private void removeSchema(PropertyCollection<?,?> schema)
remove a Schema

Parameters:
schema - the schema to remove

getSchemaBasedApplicationLayer

public PropertyCollection<?,?> getSchemaBasedApplicationLayer()
get Schema Based Application Layer

Returns:
the Schema Based Application Layer

setSchemaBasedApplicationLayer

public void setSchemaBasedApplicationLayer(PropertyCollection<?,?> layer)
set Schema Based Application Layer

Parameters:
layer - the layer to use

updateSchemaList

private void updateSchemaList()
update Schema List


getSchemaList

private PropertyCollection<?,?> getSchemaList()
get the Schema List

Returns:
the schema list

setTypeExistenceRunner

public static void setTypeExistenceRunner(Runner setTypeExistenceRunner)
Parameters:
setTypeExistenceRunner - the type existence runner to set

getTypeExistenceRunner

public static Runner getTypeExistenceRunner()
Returns:
the type existence runner to set