Class AbstractDataClassImpl
- All Implemented Interfaces:
DataClass
,PropertyHandler
- Direct Known Subclasses:
AbstractWorkflowItemClassImpl
,AggregateClassImpl
,AtomicClassImpl
,CollectionClassImpl
,DataClassImpl
,IntervalClassImpl
,NESTGraphClassImpl
,NESTGraphItemClassImpl
,UnionClassImpl
,VoidClassImpl
Abstract AbstractDataClassImpl class.
- Author:
- Rainer Maximini
-
Field Summary
Fields inherited from interface de.uni_trier.wi2.procake.data.model.DataClass
CLASS_NAME, LOG_ABSTRACT_CLASS_NOT_INSTANTIABLE, LOG_ABSTRACT_SYSTEM_SUBCLASS_CREATION_FAILED, LOG_CLASS_NOT_EDITABLE, LOG_CLASS_NOT_INSTANTIABLE, LOG_EDITABLE_CLASS_NOT_INSTANTIABLE, LOG_FINISH_EDIT_FAILED, LOG_GET_SUPERCLASSES_FAILED, LOG_SUBCLASS_CREATION_FAILED
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractDataClassImpl
(String name) Constructor for AbstractDataClassImpl. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addProperty
(PropertyTreeNode node) Add a property to the property tree.void
addProperty
(String name, String value) Add a property to the property tree.void
addSubclass
(DataClass subclass) Adds a givenn subclass to the subclassList.void
addSubClass
(DataClass subclass) addSubClass.protected void
beSystemClass.protected void
checkEditability.protected void
This method only checks if it is possible to finish the class and does not change any internal status.void
This method checks if the data class can be instantiated.protected void
clearSubClasses.createSubclass
(String name) This method creates none system sub classes that are defined by the user.protected void
createSystemClassTree
(DataClass superClass) createSystemClassTree.protected abstract void
createSystemSubClasses.void
To instantiate classes it is necessary to know if the class can be edited further.getAllProperties
(String key) Searches for all property values within the property tree.Searches for all property nodes within the property tree.getModel()
Each data class knows theModel
to that the class belongs.getName()
Each data class has a name that must be unique in theModel
.Class<? extends DataObject>
getObjectClass.getProperty
(String key) Gets the value of the node that has the given name and is found first.String[]
To receive all properties that are set byPropertyHandler.addProperty(String, String)
use this method.getPropertyNode
(String key) Search for a property node within the whole tree of properties.Returns the propertyRootNode of the implementing object.protected DataClass
getRootClass.This methods returns an array of all direct sub classes of this class.Each data class has a super class from that the class is inherited.Sometimes it can be necessary to have the inheritance hierarchy of the class.Each data class belongs to a system class with a unique name.Instead of receiving the super class of this class (DataClass.getSuperClass()
) this class returns the first super class in the class hierarchy that is a system class.boolean
Tests, if the implementing object has properties.boolean
includeClass
(DataClass anotherClass) This method checks if the data class contains a reference to another data class.boolean
isAbstract.boolean
isAdaptationCase.boolean
isAggregate.boolean
isAtomic()
isAtomic.boolean
isBoolean.boolean
isByteArray.boolean
isCake2DataReference.boolean
isChronologic.boolean
isCollection.boolean
isControlflowItem.boolean
isDataflowWrapper.boolean
isDate()
isDate.boolean
isDouble()
isDouble.boolean
isEditable.boolean
To instantiate a class it is not allowed that the class is editable or abstract.boolean
isInteger.boolean
isInterval.boolean
isList()
isList.boolean
isNESTAdaptationQuery.boolean
isNESTAdaptationRule.boolean
isNESTAdaptationSession.boolean
isNESTAdaptationStep.boolean
isNESTConstraintEdge.boolean
isNESTControlflowEdge.boolean
isNESTControlflowNode.boolean
isNESTDataflowEdge.boolean
isNESTDataNode.boolean
isNESTEdge.boolean
isNESTGraph.boolean
isNESTGraphItem.boolean
isNESTNode.boolean
isNESTPartOfEdge.boolean
isNESTQuery.boolean
isNESTSequenceNode.boolean
isNESTSequentialWorkflow.boolean
isNESTSubWorkflowNode.boolean
isNESTTaskNode.boolean
isNESTWorkflow.boolean
isNESTWorkflowNode.boolean
isNode()
isNode.boolean
isNumeric.boolean
isParentItem.boolean
isSequence.boolean
isSet()
isSet.boolean
isString()
isString.boolean
isSubclassOf
(DataClass anotherClass) Checks if this class is inherited fromanotherClass
or from a sub class ofanotherClass
.boolean
isSubWorkflow.boolean
isSystemClass.boolean
isTask()
isTask.boolean
isTime()
isTime.boolean
isTimestamp.boolean
isUnion()
isUnion.boolean
isURI()
isURI.boolean
isVoid()
isVoid.boolean
isWorkflow.boolean
isWorkflowCase.boolean
isWorkflowItem.Creates a newDataObject
and initialize it.removeProperty
(String name) Remove any node from the property tree.void
removeSubclass
(DataClass subclass) Removes a subclass from the subclassList.protected void
removeSubClass
(AbstractDataClassImpl removeClass) removeSubClass.void
setAbstract
(boolean value) It is possible to model abstract user classes.The name of a data class must be unique in the data model.void
setPropertyRootNode
(PropertyTreeNode propertyRootNode) Set the propertyRootNode of the implementing object.protected void
setSuperClass
(AbstractDataClassImpl superClass) This is the last method in the instantiation procedure that can be used for some final initializations.toString()
-
Constructor Details
-
AbstractDataClassImpl
Constructor for AbstractDataClassImpl.
- Parameters:
name
- aString
object
-
-
Method Details
-
beSystemClass
protected void beSystemClass()beSystemClass.
-
checkEditability
checkEditability.
- Throws:
IllegalEditException
- exception
-
checkFinishEditing
This method only checks if it is possible to finish the class and does not change any internal status. To initialize internal caches use the methodfinishEditing()
.Sub classes are allowed to overwrite this method with own code but they must follow some instructions. It is very important to call the
checkFinishEditing()
method in the super class. This can be done before or after the own check methods. But it is advisable to implement the methods like infinishEditing()
where first the super class is called. For example:protected void checkFinishEditing() throws ClassHierarchyConsistencyException { super.checkFinishEditing(); // put your code here }
- Throws:
ClassHierarchyConsistencyException
- See Also:
-
checkInstantiability
This method checks if the data class can be instantiated.- Specified by:
checkInstantiability
in interfaceDataClass
- Throws:
IllegalInstantiationException
-
createSubclass
public DataClass createSubclass(String name) throws ApplicationError, IllegalInstantiationException, NameAlreadyExistsException This method creates none system sub classes that are defined by the user. It is not possible to create sub-classes for abstract system classes. In that case aIllegalInstantiationException
will be thrown.Each data class has a unique name. This name must be given to this method. If the name already exists, a
NameAlreadyExistsException
will be thrown. The name can be used to access the data class from the data model by using the methodModel.getClass(String)
.The class is automatically added to the model. To remove the class again you must use the method
Model.removeClass(String)
.- Specified by:
createSubclass
in interfaceDataClass
- Parameters:
name
- The uniqe name of the new sub class.- Returns:
- The new sub class.
- Throws:
IllegalInstantiationException
NameAlreadyExistsException
ApplicationError
- See Also:
-
addSubclass
Adds a givenn subclass to the subclassList.- Specified by:
addSubclass
in interfaceDataClass
- Parameters:
subclass
- The subclass which gets added to the subclassList
-
removeSubclass
Removes a subclass from the subclassList.- Specified by:
removeSubclass
in interfaceDataClass
- Parameters:
subclass
- The subclass which gets removed from the subclassList
-
addSubClass
addSubClass.
- Parameters:
subclass
- aDataClass
object
-
createSystemClassTree
createSystemClassTree.
- Parameters:
superClass
- aDataClass
object
-
createSystemSubClasses
protected abstract void createSystemSubClasses()createSystemSubClasses.
-
finishEditing
To instantiate classes it is necessary to know if the class can be edited further. Only finished classes can be instantiated. Therefore, it is necessary to call this method to tell the system that the class is ready defined. Nevertheless, finishing a class can fail because of an inconsistency in the class hierarchy. One of the superclasses is not consistence with this class.The finishing process is distinguished into two parts:
- it is checked if it is possible to finish the class
- the class is finished
Therefore, the method
finishEditing()
first calls the methodcheckFinishEditing()
. Sub classes can overwrite both methods but must follow the instructions describe now.Sub classes are allowed to overwrite this method to initialize the class, e.g., create internal caches. But the methods must first call the method
finishEditing()
in the super class. For example:public void finishEditing() throws ClassHierarchyConsistencyException { super.finishEditing(); // put your own finishing code here }
- Specified by:
finishEditing
in interfaceDataClass
- Throws:
ClassHierarchyConsistencyException
- if any.- See Also:
-
getModel
Each data class knows theModel
to that the class belongs. -
getName
Each data class has a name that must be unique in theModel
. -
getSystemClassName
Each data class belongs to a system class with a unique name.- Specified by:
getSystemClassName
in interfaceDataClass
- Returns:
- the unique system class name
-
getPropertyRootNode
Returns the propertyRootNode of the implementing object.- Specified by:
getPropertyRootNode
in interfacePropertyHandler
- Returns:
- the propertyRootNode if set. Null otherwise.
-
setPropertyRootNode
Set the propertyRootNode of the implementing object.- Specified by:
setPropertyRootNode
in interfacePropertyHandler
- Parameters:
propertyRootNode
- to be used as property root node
-
getPropertyNode
Search for a property node within the whole tree of properties. The first node with a given name will be returned. The generic root node cannot be returned. The used search algorithm to iterate the property tree is BFS.- Specified by:
getPropertyNode
in interfacePropertyHandler
- Parameters:
key
- the name of the property to search for- Returns:
- the found property node, or null, if there are no properties or no node has this key
-
getProperty
Gets the value of the node that has the given name and is found first. If the property does not exists, null will be returned.- Specified by:
getProperty
in interfacePropertyHandler
- Parameters:
key
- The name of the property.- Returns:
- The property value or null if the property does not exists.
- See Also:
-
getPropertyNames
To receive all properties that are set byPropertyHandler.addProperty(String, String)
use this method. Every name contained in the complete tree will be considered. The result will never be null.- Specified by:
getPropertyNames
in interfacePropertyHandler
- Returns:
- An array of defined property names.
-
removeProperty
Remove any node from the property tree. The first node to be found with this name, will be removed (including all children).- Specified by:
removeProperty
in interfacePropertyHandler
- Parameters:
name
- the name of the node to be removed- Returns:
- the value of the removed node, or null, if no node could be removed
-
addProperty
Add a property to the property tree. This property node (or subtree) will be added right below the generic root.- Specified by:
addProperty
in interfacePropertyHandler
- Parameters:
node
- the node to be added
-
addProperty
Add a property to the property tree. This property node (or subtree) will be added right below the generic root.- Specified by:
addProperty
in interfacePropertyHandler
- Parameters:
name
- the name of the node to addvalue
- the value of the node to add- See Also:
-
getAllPropertyNodes
Searches for all property nodes within the property tree. The result will never be null (but could be an empty set).- Specified by:
getAllPropertyNodes
in interfacePropertyHandler
- Parameters:
key
- the key of the property- Returns:
- a set with the found property nodes
-
getAllProperties
Searches for all property values within the property tree. The result will never be null (but could be an empty set).- Specified by:
getAllProperties
in interfacePropertyHandler
- Parameters:
key
- the key of the property- Returns:
- a set with the found property nodes
-
hasProperties
public boolean hasProperties()Tests, if the implementing object has properties. This can be tested by looking for a generic root node.- Specified by:
hasProperties
in interfacePropertyHandler
- Returns:
- true, if a property is set, false otherwise.
-
getRootClass
getRootClass.
- Returns:
- a
DataClass
object
-
getSubClasses
This methods returns an array of all direct sub classes of this class. This does not include system classes or sub sub classes and so on. Only the direct ones.- Specified by:
getSubClasses
in interfaceDataClass
- Returns:
- An array of sub classes for this DataClasses or an empty array but never null.
-
getSuperClass
Each data class has a super class from that the class is inherited. This class can be get with this method. If this method is used on the root data classnull
will be returned.- Specified by:
getSuperClass
in interfaceDataClass
- Returns:
- The parent class or super class of this class or
null
if this class is the root class.
-
setSuperClass
This is the last method in the instantiation procedure that can be used for some final initializations. Implementations should first call super.setSuperClass(DataClassImpl) before using own initializations.- Parameters:
superClass
- The super class.
-
getSuperClasses
Sometimes it can be necessary to have the inheritance hierarchy of the class. This hierarchy can be accessed with this method.- Specified by:
getSuperClasses
in interfaceDataClass
- Returns:
- All super classes in the class hierarchy including the system super classes.
-
getSystemSuperClass
Instead of receiving the super class of this class (DataClass.getSuperClass()
) this class returns the first super class in the class hierarchy that is a system class.- Specified by:
getSystemSuperClass
in interfaceDataClass
- Returns:
- The first system super class in the class hierarchy.
-
includeClass
This method checks if the data class contains a reference to another data class.Some data classes contain other data classes. For example,
AggregateClass
es contain as attribute type other data classes orCollectionClass
es have one element type which is also a data class.To prevent an infinite loop, this method does not recursive navigates through all element classes. Only the element of the class are checked but not, if the elements include the given anotherClass.
- Specified by:
includeClass
in interfaceDataClass
- Parameters:
anotherClass
- The data class that has to be checked for references- Returns:
true
if the data class contains a reference to the giveanotherClass
.
-
isAbstract
public boolean isAbstract()isAbstract.
- Specified by:
isAbstract
in interfaceDataClass
- Returns:
true
if the class is abstract and can not be instantiated
-
setAbstract
It is possible to model abstract user classes. The default is that a user class is not abstract. But in special cases it can be useful to change this behavior.- Specified by:
setAbstract
in interfaceDataClass
- Parameters:
value
-true
if the user class should be an abstract class.- Throws:
IllegalEditException
- if any.
-
isAggregate
public boolean isAggregate()isAggregate.
- Specified by:
isAggregate
in interfaceDataClass
- Returns:
true
if the data class can be casted toAggregateClass
-
isAtomic
public boolean isAtomic()isAtomic.
- Specified by:
isAtomic
in interfaceDataClass
- Returns:
true
if the data class can be casted toAtomicClass
-
isBoolean
public boolean isBoolean()isBoolean.
- Specified by:
isBoolean
in interfaceDataClass
- Returns:
true
if the data class can be casted toBooleanClass
-
isByteArray
public boolean isByteArray()isByteArray.
- Specified by:
isByteArray
in interfaceDataClass
- Returns:
true
if the data class can be casted toByteArrayClass
-
isChronologic
public boolean isChronologic()isChronologic.
- Specified by:
isChronologic
in interfaceDataClass
- Returns:
true
if the data class can be casted toChronologicClass
-
isCollection
public boolean isCollection()isCollection.
- Specified by:
isCollection
in interfaceDataClass
- Returns:
true
if the data class can be casted toCollectionClass
-
isDate
public boolean isDate()isDate.
-
isDouble
public boolean isDouble()isDouble.
- Specified by:
isDouble
in interfaceDataClass
- Returns:
true
if the data class can be casted toDoubleClass
-
isEditable
public boolean isEditable()isEditable.
- Specified by:
isEditable
in interfaceDataClass
- Returns:
true
if the class can be edited
-
isInstantiable
public boolean isInstantiable()To instantiate a class it is not allowed that the class is editable or abstract. Some system classes are also not instantiable- Specified by:
isInstantiable
in interfaceDataClass
- Returns:
true
if this class can be instantiated.
-
isInteger
public boolean isInteger()isInteger.
- Specified by:
isInteger
in interfaceDataClass
- Returns:
true
if the data class can be casted toIntegerClass
-
isInterval
public boolean isInterval()isInterval.
- Specified by:
isInterval
in interfaceDataClass
- Returns:
true
if the data class can be casted toIntervalClass
-
isList
public boolean isList()isList.
-
isNumeric
public boolean isNumeric()isNumeric.
- Specified by:
isNumeric
in interfaceDataClass
- Returns:
true
if the data class can be casted toNumericClass
-
isURI
public boolean isURI()isURI.
-
isSet
public boolean isSet()isSet.
-
isString
public boolean isString()isString.
- Specified by:
isString
in interfaceDataClass
- Returns:
true
if the data class can be casted toStringClass
-
isAdaptationCase
public boolean isAdaptationCase()isAdaptationCase.
- Returns:
- a boolean
-
isSequence
public boolean isSequence()isSequence.
- Specified by:
isSequence
in interfaceDataClass
- Returns:
true
if the data class can be casted toSequenceClass
-
isWorkflow
public boolean isWorkflow()isWorkflow.
- Specified by:
isWorkflow
in interfaceDataClass
- Returns:
true
if the data class can be casted toWorkflowClass
-
isTask
public boolean isTask()isTask.
-
isNode
public boolean isNode()isNode.
-
isDataflowWrapper
public boolean isDataflowWrapper()isDataflowWrapper.
- Specified by:
isDataflowWrapper
in interfaceDataClass
- Returns:
true
if the data class can be casted toDataflowWrapperClass
-
isWorkflowItem
public boolean isWorkflowItem()isWorkflowItem.
- Specified by:
isWorkflowItem
in interfaceDataClass
- Returns:
true
if the data class can be casted toAbstractWorkflowItemClass
-
isSubWorkflow
public boolean isSubWorkflow()isSubWorkflow.
- Specified by:
isSubWorkflow
in interfaceDataClass
- Returns:
true
if the data class can be casted toSubWorkflowClass
-
isControlflowItem
public boolean isControlflowItem()isControlflowItem.
- Specified by:
isControlflowItem
in interfaceDataClass
- Returns:
true
if the data class can be casted toControlflowItemClass
-
isParentItem
public boolean isParentItem()isParentItem.
- Specified by:
isParentItem
in interfaceDataClass
- Returns:
true
if the data class can be casted toParentItemClass
-
isNESTNode
public boolean isNESTNode()isNESTNode.
- Specified by:
isNESTNode
in interfaceDataClass
- Returns:
true
if the data class can be casted toNESTNodeClass
-
isNESTControlflowNode
public boolean isNESTControlflowNode()isNESTControlflowNode.
- Specified by:
isNESTControlflowNode
in interfaceDataClass
- Returns:
true
if the data class can be casted toNESTControlflowNodeClass
-
isNESTDataNode
public boolean isNESTDataNode()isNESTDataNode.
- Specified by:
isNESTDataNode
in interfaceDataClass
- Returns:
true
if the data class can be casted toNESTDataNodeClass
-
isNESTTaskNode
public boolean isNESTTaskNode()isNESTTaskNode.
- Specified by:
isNESTTaskNode
in interfaceDataClass
- Returns:
true
if the data class can be casted toNESTTaskNodeClass
-
isNESTSequenceNode
public boolean isNESTSequenceNode()isNESTSequenceNode.
- Specified by:
isNESTSequenceNode
in interfaceDataClass
- Returns:
true
if the data class can be casted toNESTTaskNodeClass
orNESTControlflowNodeClass
-
isNESTWorkflowNode
public boolean isNESTWorkflowNode()isNESTWorkflowNode.
- Specified by:
isNESTWorkflowNode
in interfaceDataClass
- Returns:
true
if the data class can be casted toNESTWorkflowNodeClass
-
isNESTSubWorkflowNode
public boolean isNESTSubWorkflowNode()isNESTSubWorkflowNode.
- Specified by:
isNESTSubWorkflowNode
in interfaceDataClass
- Returns:
true
if the data class can be casted toNESTSubWorkflowNodeClass
-
isNESTEdge
public boolean isNESTEdge()isNESTEdge.
- Specified by:
isNESTEdge
in interfaceDataClass
- Returns:
true
if the data class can be casted toNESTEdgeClass
-
isNESTConstraintEdge
public boolean isNESTConstraintEdge()isNESTConstraintEdge.
- Specified by:
isNESTConstraintEdge
in interfaceDataClass
- Returns:
true
if the data class can be casted toNESTConstraintEdgeClass
-
isNESTControlflowEdge
public boolean isNESTControlflowEdge()isNESTControlflowEdge.
- Specified by:
isNESTControlflowEdge
in interfaceDataClass
- Returns:
true
if the data class can be casted toNESTControlflowEdgeClass
-
isNESTDataflowEdge
public boolean isNESTDataflowEdge()isNESTDataflowEdge.
- Specified by:
isNESTDataflowEdge
in interfaceDataClass
- Returns:
true
if the data class can be casted toNESTDataflowEdgeClass
-
isNESTPartOfEdge
public boolean isNESTPartOfEdge()isNESTPartOfEdge.
- Specified by:
isNESTPartOfEdge
in interfaceDataClass
- Returns:
true
if the data class can be casted toNESTPartOfEdgeClass
-
isNESTGraph
public boolean isNESTGraph()isNESTGraph.
- Specified by:
isNESTGraph
in interfaceDataClass
- Returns:
true
if the data class can be casted toNESTGraphClass
-
isNESTSequentialWorkflow
public boolean isNESTSequentialWorkflow()isNESTSequentialWorkflow.
- Specified by:
isNESTSequentialWorkflow
in interfaceDataClass
- Returns:
true
if the data class can be casted toNESTSequentialWorkflowClass
-
isNESTWorkflow
public boolean isNESTWorkflow()isNESTWorkflow.
- Specified by:
isNESTWorkflow
in interfaceDataClass
- Returns:
true
if the data class can be casted toNESTWorkflowClass
-
isNESTGraphItem
public boolean isNESTGraphItem()isNESTGraphItem.
- Specified by:
isNESTGraphItem
in interfaceDataClass
- Returns:
true
if the data class can be casted toNESTGraphItemClass
-
isNESTQuery
public boolean isNESTQuery()isNESTQuery.
- Returns:
- a boolean
-
isNESTAdaptationQuery
public boolean isNESTAdaptationQuery()isNESTAdaptationQuery.
- Returns:
- a boolean
-
isCake2DataReference
public boolean isCake2DataReference()isCake2DataReference.
- Specified by:
isCake2DataReference
in interfaceDataClass
- Returns:
true
if the data class can be casted toDataReferenceClass
-
isNESTAdaptationRule
public boolean isNESTAdaptationRule()isNESTAdaptationRule.
- Returns:
- a boolean
-
isNESTAdaptationStep
public boolean isNESTAdaptationStep()isNESTAdaptationStep.
- Returns:
- a boolean
-
isNESTAdaptationSession
public boolean isNESTAdaptationSession()isNESTAdaptationSession.
- Returns:
- a boolean
-
isWorkflowCase
public boolean isWorkflowCase()isWorkflowCase.
- Returns:
- a boolean
-
isSubclassOf
Checks if this class is inherited fromanotherClass
or from a sub class ofanotherClass
.- Specified by:
isSubclassOf
in interfaceDataClass
- Parameters:
anotherClass
- aDataClass
object- Returns:
true
if this class is a subclass ofanotherClass
-
isSystemClass
public boolean isSystemClass()isSystemClass.
- Specified by:
isSystemClass
in interfaceDataClass
- Returns:
true
if this class is a system class.
-
isTime
public boolean isTime()isTime.
-
isTimestamp
public boolean isTimestamp()isTimestamp.
- Specified by:
isTimestamp
in interfaceDataClass
- Returns:
true
if the data class can be casted toTimestampClass
-
isUnion
public boolean isUnion()isUnion.
- Specified by:
isUnion
in interfaceDataClass
- Returns:
true
if the data class can be casted toUnionClass
-
isVoid
public boolean isVoid()isVoid.
-
newObject
Creates a newDataObject
and initialize it.DataObject
s can not be created directly because they depend on theDataClass
that defines the object.The creation of a new object is only be possible if
DataClass.checkInstantiability()
throws no exception.- Specified by:
newObject
in interfaceDataClass
- Returns:
- a new
DataObject
- Throws:
IllegalInstantiationException
- is thrown if it is not possible to create an object this data class
-
getObjectClass
getObjectClass.
- Specified by:
getObjectClass
in interfaceDataClass
- Returns:
- Class of the corresponding data object
-
removeSubClass
removeSubClass.
- Parameters:
removeClass
- aAbstractDataClassImpl
object
-
clearSubClasses
protected void clearSubClasses()clearSubClasses.
-
setName
The name of a data class must be unique in the data model. If this is not the case, theNameAlreadyExistsException
will be thrown. To rename the data class tthis method can be used, too.- Specified by:
setName
in interfaceDataClass
- Parameters:
newName
- A unique name of the data class.- Returns:
- The name of the class.
- Throws:
IllegalEditException
NameAlreadyExistsException
-
toString
-