Class AbstractDataClassImpl

java.lang.Object
de.uni_trier.wi2.procake.data.model.impl.AbstractDataClassImpl
All Implemented Interfaces:
DataClass, PropertyHandler
Direct Known Subclasses:
AbstractWorkflowItemClassImpl, AggregateClassImpl, AtomicClassImpl, CollectionClassImpl, DataClassImpl, IntervalClassImpl, NESTGraphClassImpl, NESTGraphItemClassImpl, UnionClassImpl, VoidClassImpl

public abstract class AbstractDataClassImpl extends Object implements DataClass

Abstract AbstractDataClassImpl class.

Author:
Rainer Maximini
  • Constructor Details

    • AbstractDataClassImpl

      protected AbstractDataClassImpl(String name)

      Constructor for AbstractDataClassImpl.

      Parameters:
      name - a String object
  • Method Details

    • beSystemClass

      protected void beSystemClass()

      beSystemClass.

    • checkEditability

      protected void checkEditability() throws IllegalEditException

      checkEditability.

      Throws:
      IllegalEditException - exception
    • checkFinishEditing

      protected void checkFinishEditing() throws ClassHierarchyConsistencyException
      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 method finishEditing().

      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 in finishEditing() 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

      public void checkInstantiability() throws IllegalInstantiationException
      This method checks if the data class can be instantiated.
      Specified by:
      checkInstantiability in interface DataClass
      Throws:
      IllegalInstantiationException
    • createSubclass

      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 a IllegalInstantiationException 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 method Model.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 interface DataClass
      Parameters:
      name - The uniqe name of the new sub class.
      Returns:
      The new sub class.
      Throws:
      IllegalInstantiationException
      NameAlreadyExistsException
      ApplicationError
      See Also:
    • addSubclass

      public void addSubclass(DataClass subclass)
      Adds a givenn subclass to the subclassList.
      Specified by:
      addSubclass in interface DataClass
      Parameters:
      subclass - The subclass which gets added to the subclassList
    • removeSubclass

      public void removeSubclass(DataClass subclass)
      Removes a subclass from the subclassList.
      Specified by:
      removeSubclass in interface DataClass
      Parameters:
      subclass - The subclass which gets removed from the subclassList
    • addSubClass

      public void addSubClass(DataClass subclass)

      addSubClass.

      Parameters:
      subclass - a DataClass object
    • createSystemClassTree

      protected void createSystemClassTree(DataClass superClass)

      createSystemClassTree.

      Parameters:
      superClass - a DataClass object
    • createSystemSubClasses

      protected abstract void createSystemSubClasses()

      createSystemSubClasses.

    • finishEditing

      public void finishEditing() throws ClassHierarchyConsistencyException
      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:

      1. it is checked if it is possible to finish the class
      2. the class is finished

      Therefore, the method finishEditing() first calls the method checkFinishEditing(). 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 interface DataClass
      Throws:
      ClassHierarchyConsistencyException - if any.
      See Also:
    • getModel

      public Model getModel()
      Each data class knows the Model to that the class belongs.
      Specified by:
      getModel in interface DataClass
      Returns:
      The Model of the data class.
    • getName

      public String getName()
      Each data class has a name that must be unique in the Model.
      Specified by:
      getName in interface DataClass
      Returns:
      the unique name of the data class
    • getSystemClassName

      public String getSystemClassName()
      Each data class belongs to a system class with a unique name.
      Specified by:
      getSystemClassName in interface DataClass
      Returns:
      the unique system class name
    • getPropertyRootNode

      public PropertyTreeNode getPropertyRootNode()
      Returns the propertyRootNode of the implementing object.
      Specified by:
      getPropertyRootNode in interface PropertyHandler
      Returns:
      the propertyRootNode if set. Null otherwise.
    • setPropertyRootNode

      public void setPropertyRootNode(PropertyTreeNode propertyRootNode)
      Set the propertyRootNode of the implementing object.
      Specified by:
      setPropertyRootNode in interface PropertyHandler
      Parameters:
      propertyRootNode - to be used as property root node
    • getPropertyNode

      public PropertyTreeNode getPropertyNode(String key)
      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 interface PropertyHandler
      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

      public String getProperty(String key)
      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 interface PropertyHandler
      Parameters:
      key - The name of the property.
      Returns:
      The property value or null if the property does not exists.
      See Also:
    • getPropertyNames

      public String[] getPropertyNames()
      To receive all properties that are set by PropertyHandler.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 interface PropertyHandler
      Returns:
      An array of defined property names.
    • removeProperty

      public String removeProperty(String name)
      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 interface PropertyHandler
      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

      public void addProperty(PropertyTreeNode node)
      Add a property to the property tree. This property node (or subtree) will be added right below the generic root.
      Specified by:
      addProperty in interface PropertyHandler
      Parameters:
      node - the node to be added
    • addProperty

      public void addProperty(String name, String value)
      Add a property to the property tree. This property node (or subtree) will be added right below the generic root.
      Specified by:
      addProperty in interface PropertyHandler
      Parameters:
      name - the name of the node to add
      value - the value of the node to add
      See Also:
    • getAllPropertyNodes

      public List<PropertyTreeNode> getAllPropertyNodes(String key)
      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 interface PropertyHandler
      Parameters:
      key - the key of the property
      Returns:
      a set with the found property nodes
    • getAllProperties

      public List<String> getAllProperties(String key)
      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 interface PropertyHandler
      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 interface PropertyHandler
      Returns:
      true, if a property is set, false otherwise.
    • getRootClass

      protected DataClass getRootClass()

      getRootClass.

      Returns:
      a DataClass object
    • getSubClasses

      public List<DataClass> 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 interface DataClass
      Returns:
      An array of sub classes for this DataClasses or an empty array but never null.
    • getSuperClass

      public DataClass 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 class null will be returned.
      Specified by:
      getSuperClass in interface DataClass
      Returns:
      The parent class or super class of this class or null if this class is the root class.
    • setSuperClass

      protected void setSuperClass(AbstractDataClassImpl superClass)
      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

      public DataClass[] 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 interface DataClass
      Returns:
      All super classes in the class hierarchy including the system super classes.
    • getSystemSuperClass

      public DataClass 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 interface DataClass
      Returns:
      The first system super class in the class hierarchy.
    • includeClass

      public boolean includeClass(DataClass anotherClass)
      This method checks if the data class contains a reference to another data class.

      Some data classes contain other data classes. For example, AggregateClasses contain as attribute type other data classes or CollectionClasses 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 interface DataClass
      Parameters:
      anotherClass - The data class that has to be checked for references
      Returns:
      true if the data class contains a reference to the give anotherClass.
    • isAbstract

      public boolean isAbstract()

      isAbstract.

      Specified by:
      isAbstract in interface DataClass
      Returns:
      true if the class is abstract and can not be instantiated
    • setAbstract

      public void setAbstract(boolean value) throws IllegalEditException
      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 interface DataClass
      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 interface DataClass
      Returns:
      true if the data class can be casted to AggregateClass
    • isAtomic

      public boolean isAtomic()

      isAtomic.

      Specified by:
      isAtomic in interface DataClass
      Returns:
      true if the data class can be casted to AtomicClass
    • isBoolean

      public boolean isBoolean()

      isBoolean.

      Specified by:
      isBoolean in interface DataClass
      Returns:
      true if the data class can be casted to BooleanClass
    • isByteArray

      public boolean isByteArray()

      isByteArray.

      Specified by:
      isByteArray in interface DataClass
      Returns:
      true if the data class can be casted to ByteArrayClass
    • isChronologic

      public boolean isChronologic()

      isChronologic.

      Specified by:
      isChronologic in interface DataClass
      Returns:
      true if the data class can be casted to ChronologicClass
    • isCollection

      public boolean isCollection()

      isCollection.

      Specified by:
      isCollection in interface DataClass
      Returns:
      true if the data class can be casted to CollectionClass
    • isDate

      public boolean isDate()

      isDate.

      Specified by:
      isDate in interface DataClass
      Returns:
      true if the data class can be casted to DateClass
    • isDouble

      public boolean isDouble()

      isDouble.

      Specified by:
      isDouble in interface DataClass
      Returns:
      true if the data class can be casted to DoubleClass
    • isEditable

      public boolean isEditable()

      isEditable.

      Specified by:
      isEditable in interface DataClass
      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 interface DataClass
      Returns:
      true if this class can be instantiated.
    • isInteger

      public boolean isInteger()

      isInteger.

      Specified by:
      isInteger in interface DataClass
      Returns:
      true if the data class can be casted to IntegerClass
    • isInterval

      public boolean isInterval()

      isInterval.

      Specified by:
      isInterval in interface DataClass
      Returns:
      true if the data class can be casted to IntervalClass
    • isList

      public boolean isList()

      isList.

      Specified by:
      isList in interface DataClass
      Returns:
      true if the data class can be casted to ListClass
    • isNumeric

      public boolean isNumeric()

      isNumeric.

      Specified by:
      isNumeric in interface DataClass
      Returns:
      true if the data class can be casted to NumericClass
    • isURI

      public boolean isURI()

      isURI.

      Specified by:
      isURI in interface DataClass
      Returns:
      true if the data class can be casted to URIClass
    • isSet

      public boolean isSet()

      isSet.

      Specified by:
      isSet in interface DataClass
      Returns:
      true if the data class can be casted to SetClass
    • isString

      public boolean isString()

      isString.

      Specified by:
      isString in interface DataClass
      Returns:
      true if the data class can be casted to StringClass
    • isAdaptationCase

      public boolean isAdaptationCase()

      isAdaptationCase.

      Returns:
      a boolean
    • isSequence

      public boolean isSequence()

      isSequence.

      Specified by:
      isSequence in interface DataClass
      Returns:
      true if the data class can be casted to SequenceClass
    • isWorkflow

      public boolean isWorkflow()

      isWorkflow.

      Specified by:
      isWorkflow in interface DataClass
      Returns:
      true if the data class can be casted to WorkflowClass
    • isTask

      public boolean isTask()

      isTask.

      Specified by:
      isTask in interface DataClass
      Returns:
      true if the data class can be casted to TaskClass
    • isNode

      public boolean isNode()

      isNode.

      Specified by:
      isNode in interface DataClass
      Returns:
      true if the data class can be casted to NodeClass
    • isDataflowWrapper

      public boolean isDataflowWrapper()

      isDataflowWrapper.

      Specified by:
      isDataflowWrapper in interface DataClass
      Returns:
      true if the data class can be casted to DataflowWrapperClass
    • isWorkflowItem

      public boolean isWorkflowItem()

      isWorkflowItem.

      Specified by:
      isWorkflowItem in interface DataClass
      Returns:
      true if the data class can be casted to AbstractWorkflowItemClass
    • isSubWorkflow

      public boolean isSubWorkflow()

      isSubWorkflow.

      Specified by:
      isSubWorkflow in interface DataClass
      Returns:
      true if the data class can be casted to SubWorkflowClass
    • isControlflowItem

      public boolean isControlflowItem()

      isControlflowItem.

      Specified by:
      isControlflowItem in interface DataClass
      Returns:
      true if the data class can be casted to ControlflowItemClass
    • isParentItem

      public boolean isParentItem()

      isParentItem.

      Specified by:
      isParentItem in interface DataClass
      Returns:
      true if the data class can be casted to ParentItemClass
    • isNESTNode

      public boolean isNESTNode()

      isNESTNode.

      Specified by:
      isNESTNode in interface DataClass
      Returns:
      true if the data class can be casted to NESTNodeClass
    • isNESTControlflowNode

      public boolean isNESTControlflowNode()

      isNESTControlflowNode.

      Specified by:
      isNESTControlflowNode in interface DataClass
      Returns:
      true if the data class can be casted to NESTControlflowNodeClass
    • isNESTDataNode

      public boolean isNESTDataNode()

      isNESTDataNode.

      Specified by:
      isNESTDataNode in interface DataClass
      Returns:
      true if the data class can be casted to NESTDataNodeClass
    • isNESTTaskNode

      public boolean isNESTTaskNode()

      isNESTTaskNode.

      Specified by:
      isNESTTaskNode in interface DataClass
      Returns:
      true if the data class can be casted to NESTTaskNodeClass
    • isNESTSequenceNode

      public boolean isNESTSequenceNode()

      isNESTSequenceNode.

      Specified by:
      isNESTSequenceNode in interface DataClass
      Returns:
      true if the data class can be casted to NESTTaskNodeClass or NESTControlflowNodeClass
    • isNESTWorkflowNode

      public boolean isNESTWorkflowNode()

      isNESTWorkflowNode.

      Specified by:
      isNESTWorkflowNode in interface DataClass
      Returns:
      true if the data class can be casted to NESTWorkflowNodeClass
    • isNESTSubWorkflowNode

      public boolean isNESTSubWorkflowNode()

      isNESTSubWorkflowNode.

      Specified by:
      isNESTSubWorkflowNode in interface DataClass
      Returns:
      true if the data class can be casted to NESTSubWorkflowNodeClass
    • isNESTEdge

      public boolean isNESTEdge()

      isNESTEdge.

      Specified by:
      isNESTEdge in interface DataClass
      Returns:
      true if the data class can be casted to NESTEdgeClass
    • isNESTConstraintEdge

      public boolean isNESTConstraintEdge()

      isNESTConstraintEdge.

      Specified by:
      isNESTConstraintEdge in interface DataClass
      Returns:
      true if the data class can be casted to NESTConstraintEdgeClass
    • isNESTControlflowEdge

      public boolean isNESTControlflowEdge()

      isNESTControlflowEdge.

      Specified by:
      isNESTControlflowEdge in interface DataClass
      Returns:
      true if the data class can be casted to NESTControlflowEdgeClass
    • isNESTDataflowEdge

      public boolean isNESTDataflowEdge()

      isNESTDataflowEdge.

      Specified by:
      isNESTDataflowEdge in interface DataClass
      Returns:
      true if the data class can be casted to NESTDataflowEdgeClass
    • isNESTPartOfEdge

      public boolean isNESTPartOfEdge()

      isNESTPartOfEdge.

      Specified by:
      isNESTPartOfEdge in interface DataClass
      Returns:
      true if the data class can be casted to NESTPartOfEdgeClass
    • isNESTGraph

      public boolean isNESTGraph()

      isNESTGraph.

      Specified by:
      isNESTGraph in interface DataClass
      Returns:
      true if the data class can be casted to NESTGraphClass
    • isNESTSequentialWorkflow

      public boolean isNESTSequentialWorkflow()

      isNESTSequentialWorkflow.

      Specified by:
      isNESTSequentialWorkflow in interface DataClass
      Returns:
      true if the data class can be casted to NESTSequentialWorkflowClass
    • isNESTWorkflow

      public boolean isNESTWorkflow()

      isNESTWorkflow.

      Specified by:
      isNESTWorkflow in interface DataClass
      Returns:
      true if the data class can be casted to NESTWorkflowClass
    • isNESTGraphItem

      public boolean isNESTGraphItem()

      isNESTGraphItem.

      Specified by:
      isNESTGraphItem in interface DataClass
      Returns:
      true if the data class can be casted to NESTGraphItemClass
    • 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 interface DataClass
      Returns:
      true if the data class can be casted to DataReferenceClass
    • 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

      public boolean isSubclassOf(DataClass anotherClass)
      Checks if this class is inherited from anotherClass or from a sub class of anotherClass.
      Specified by:
      isSubclassOf in interface DataClass
      Parameters:
      anotherClass - a DataClass object
      Returns:
      true if this class is a subclass of anotherClass
    • isSystemClass

      public boolean isSystemClass()

      isSystemClass.

      Specified by:
      isSystemClass in interface DataClass
      Returns:
      true if this class is a system class.
    • isTime

      public boolean isTime()

      isTime.

      Specified by:
      isTime in interface DataClass
      Returns:
      true if the data class can be casted to TimeClass
    • isTimestamp

      public boolean isTimestamp()

      isTimestamp.

      Specified by:
      isTimestamp in interface DataClass
      Returns:
      true if the data class can be casted to TimestampClass
    • isUnion

      public boolean isUnion()

      isUnion.

      Specified by:
      isUnion in interface DataClass
      Returns:
      true if the data class can be casted to UnionClass
    • isVoid

      public boolean isVoid()

      isVoid.

      Specified by:
      isVoid in interface DataClass
      Returns:
      true if the data class can be casted to VoidClass
    • newObject

      public DataObject newObject() throws IllegalInstantiationException
      Creates a new DataObject and initialize it. DataObjects can not be created directly because they depend on the DataClass that defines the object.

      The creation of a new object is only be possible if DataClass.checkInstantiability() throws no exception.

      Specified by:
      newObject in interface DataClass
      Returns:
      a new DataObject
      Throws:
      IllegalInstantiationException - is thrown if it is not possible to create an object this data class
    • getObjectClass

      public Class<? extends DataObject> getObjectClass()

      getObjectClass.

      Specified by:
      getObjectClass in interface DataClass
      Returns:
      Class of the corresponding data object
    • removeSubClass

      protected void removeSubClass(AbstractDataClassImpl removeClass)

      removeSubClass.

      Parameters:
      removeClass - a AbstractDataClassImpl 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, the NameAlreadyExistsException will be thrown. To rename the data class tthis method can be used, too.
      Specified by:
      setName in interface DataClass
      Parameters:
      newName - A unique name of the data class.
      Returns:
      The name of the class.
      Throws:
      IllegalEditException
      NameAlreadyExistsException
    • toString

      public String toString()
      Overrides:
      toString in class Object