Class AggregateClassImpl
- All Implemented Interfaces:
AggregateClass
,DataClass
,PropertyHandler
AggregateClassImpl class.
- Author:
- Rainer Maximini
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.uni_trier.wi2.procake.data.model.base.AggregateClass
AggregateClass.AttributeInfo
-
Field Summary
Fields inherited from interface de.uni_trier.wi2.procake.data.model.base.AggregateClass
CLASS_NAME, LOG_ATTRIBUTE_NAME_ALREADY_EXISTS, LOG_GET_PROPERTIES_ATT_FAILED, LOG_GET_PROPERTY_ATT_FAILED, LOG_SET_PROPERTY_ATT_FAILED
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
ModifierConstructorDescriptionConstructor for AggregateClassImpl.protected
AggregateClassImpl
(String name) Constructor for AggregateClassImpl. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttribute
(String attributeName, DataClass attributeType) Adds an attribute an the end of the attribute list.void
addAttributeProperty
(String attributeName, PropertyTreeNode newNode) addAttributeProperty.void
addAttributeProperty
(String attributeName, String propertyName, String propertyValue) Sets a new property value or overwrites an existing one for the given attribute with the valuepropertyValue
.void
conformToModel
(Model other) Checks all properties whether they conform to given model.boolean
containsAttribute
(String attributeName) Checks if the given attribute name is visible in this class.createSubclass
(String name) This method creates none system sub classes that are defined by the user.protected void
createSystemSubClasses.void
To instantiate classes it is necessary to know if the class can be edited further.getAttributeInfos.An array of all visible attributes should be returned.getAttributeProperty
(String attributeName, String propertyName) Gets the value of the given property name for the given attribute.String[]
getAttributePropertyNames
(String attributeName) To receive all properties of an attribute that are set use this method.getAttributeType
(String attributeName) Determine the type of the specified attribute.String[]
An array of all inherited attribute names.getInheritedAttributeType
(String attributeName) getInheritedAttributeType.String[]
An array of all local defined attribute names.getLocalAttributeType
(String attributeName) getLocalAttributeType.int
getNumberOfAttributes() == getAttributeNames().size();
int
getNumberOfLocalAttributes() == getLocalAttributeNames().size();
Class<? extends DataObject>
getObjectClass.String[]
An array of all local defined attribute names that override an attribute definition from one of the super classes.boolean
hasAttribute
(String attributeName) Checks if the attribute name is defined in this class or in one of the super classesboolean
includeClass
(DataClass other) This method checks if the data class contains a reference to another data class.boolean
isAggregate.Creates a newDataObject
and initialize it.void
removeAttribute
(String attributeName) removes the given attributeremoveAttributeProperty
(String attributeName, String propertyName) A property for a given attribute can be removed by setting anull
property value or by using this method.void
updateAttributeType
(String attributeName, DataClass newType) To change the type of the attribute call this message.Methods inherited from class de.uni_trier.wi2.procake.data.model.impl.AbstractDataClassImpl
addProperty, addProperty, addSubclass, addSubClass, beSystemClass, checkEditability, checkFinishEditing, checkInstantiability, clearSubClasses, createSystemClassTree, getAllProperties, getAllPropertyNodes, getModel, getName, getProperty, getPropertyNames, getPropertyNode, getPropertyRootNode, getRootClass, getSubClasses, getSuperClass, getSuperClasses, getSystemClassName, getSystemSuperClass, hasProperties, isAbstract, isAdaptationCase, isAtomic, isBoolean, isByteArray, isCake2DataReference, isChronologic, isCollection, isControlflowItem, isDataflowWrapper, isDate, isDouble, isEditable, isInstantiable, isInteger, isInterval, isList, isNESTAdaptationQuery, isNESTAdaptationRule, isNESTAdaptationSession, isNESTAdaptationStep, isNESTConstraintEdge, isNESTControlflowEdge, isNESTControlflowNode, isNESTDataflowEdge, isNESTDataNode, isNESTEdge, isNESTGraph, isNESTGraphItem, isNESTNode, isNESTPartOfEdge, isNESTQuery, isNESTSequenceNode, isNESTSequentialWorkflow, isNESTSubWorkflowNode, isNESTTaskNode, isNESTWorkflow, isNESTWorkflowNode, isNode, isNumeric, isParentItem, isSequence, isSet, isString, isSubclassOf, isSubWorkflow, isSystemClass, isTask, isTime, isTimestamp, isUnion, isURI, isVoid, isWorkflow, isWorkflowCase, isWorkflowItem, removeProperty, removeSubclass, removeSubClass, setAbstract, setName, setPropertyRootNode, setSuperClass, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface de.uni_trier.wi2.procake.data.model.DataClass
addSubclass, checkInstantiability, getModel, getName, getSubClasses, getSuperClass, getSuperClasses, getSystemClassName, getSystemSuperClass, isAbstract, isAtomic, isBoolean, isByteArray, isCake2DataReference, isChronologic, isCollection, isControlflowItem, isDataflowWrapper, isDate, isDouble, isEditable, isInstantiable, isInteger, isInterval, isList, isNESTConstraintEdge, isNESTControlflowEdge, isNESTControlflowNode, isNESTDataflowEdge, isNESTDataNode, isNESTEdge, isNESTGraph, isNESTGraphItem, isNESTNode, isNESTPartOfEdge, isNESTSequenceNode, isNESTSequentialWorkflow, isNESTSubWorkflowNode, isNESTTaskNode, isNESTWorkflow, isNESTWorkflowNode, isNode, isNumeric, isParentItem, isSequence, isSet, isString, isSubclassOf, isSubWorkflow, isSystemClass, isTask, isTime, isTimestamp, isUnion, isURI, isVoid, isWorkflow, isWorkflowItem, removeSubclass, setAbstract, setName
Methods inherited from interface de.uni_trier.wi2.procake.data.PropertyHandler
addProperty, addProperty, getAllProperties, getAllPropertyNodes, getProperty, getPropertyNames, getPropertyNode, getPropertyRootNode, hasProperties, removeProperty, setPropertyRootNode
-
Constructor Details
-
AggregateClassImpl
public AggregateClassImpl()Constructor for AggregateClassImpl.
-
AggregateClassImpl
Constructor for AggregateClassImpl.
- Parameters:
name
- aString
object
-
-
Method Details
-
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
- Overrides:
createSubclass
in classAbstractDataClassImpl
- Parameters:
name
- The uniqe name of the new sub class.- Returns:
- The new sub class.
- Throws:
IllegalInstantiationException
NameAlreadyExistsException
ApplicationError
- See Also:
-
addAttribute
public void addAttribute(String attributeName, DataClass attributeType) throws NameAlreadyExistsException, IllegalEditException Adds an attribute an the end of the attribute list.- Specified by:
addAttribute
in interfaceAggregateClass
- Parameters:
attributeName
- aString
objectattributeType
- aDataClass
object- Throws:
NameAlreadyExistsException
IllegalEditException
- if any.
-
containsAttribute
Checks if the given attribute name is visible in this class.- Specified by:
containsAttribute
in interfaceAggregateClass
- Parameters:
attributeName
- aString
object- Returns:
- true if the given attribute name exists in this or in one of the parent AggregateClasses.
-
createSystemSubClasses
protected void createSystemSubClasses()createSystemSubClasses.
- Specified by:
createSystemSubClasses
in classAbstractDataClassImpl
-
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
AbstractDataClassImpl.finishEditing()
first calls the methodAbstractDataClassImpl.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
AbstractDataClassImpl.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
- Overrides:
finishEditing
in classAbstractDataClassImpl
- Throws:
ClassHierarchyConsistencyException
- if any.- See Also:
-
getAttributeNames
An array of all visible attributes should be returned. That includes all local defined attributes and all attributes from all super classes. Overriden attributes are only returned once.The order in the array is not fixed and can vary in each message call.
Please note that the usage of this method does not work if the aggregate class is not finished.
- Specified by:
getAttributeNames
in interfaceAggregateClass
- Returns:
- An array of attribute names. The result is never be null.
-
getAttributeInfos
getAttributeInfos.
- Specified by:
getAttributeInfos
in interfaceAggregateClass
- Returns:
- A list of attribute informations.
-
getAttributeType
Determine the type of the specified attribute. Warning: Only works on finished classes, returnsnull
otherwise. To determine attribute-types in unfinished classes, callgetInheritedAttributeType
orgetLocalAttributeType
.- Specified by:
getAttributeType
in interfaceAggregateClass
- Parameters:
attributeName
- aString
object- Returns:
- the type of the given attribute or null, if the attribute not exist
-
getInheritedAttributeNames
An array of all inherited attribute names.The order in the array is not fixed and can vary in each message call.
- Specified by:
getInheritedAttributeNames
in interfaceAggregateClass
- Returns:
- An array of inherited attribute names. The result is never be null.
-
getInheritedAttributeType
getInheritedAttributeType.
- Specified by:
getInheritedAttributeType
in interfaceAggregateClass
- Parameters:
attributeName
- aString
object- Returns:
- the type of the given attribute or null, if the attribute not exist in one of the parents
-
getLocalAttributeNames
An array of all local defined attribute names.The order in the array is not fixed and can vary in each message call.
- Specified by:
getLocalAttributeNames
in interfaceAggregateClass
- Returns:
- An array of local attribute names. The result is never be null.
-
getLocalAttributeType
getLocalAttributeType.
- Specified by:
getLocalAttributeType
in interfaceAggregateClass
- Parameters:
attributeName
- aString
object- Returns:
- the type of the given attribute or null, if the attribute not exist
-
getNumberOfAttributes
public int getNumberOfAttributes()getNumberOfAttributes() == getAttributeNames().size();
- Specified by:
getNumberOfAttributes
in interfaceAggregateClass
- Returns:
- the number of visible attributes.
-
getNumberOfLocalAttributes
public int getNumberOfLocalAttributes()getNumberOfLocalAttributes() == getLocalAttributeNames().size();
- Specified by:
getNumberOfLocalAttributes
in interfaceAggregateClass
- Returns:
- the number of visible attributes.
-
getOverridenAttributeNames
An array of all local defined attribute names that override an attribute definition from one of the super classes.The order in the array is not fixed and can vary in each message call.
- Specified by:
getOverridenAttributeNames
in interfaceAggregateClass
- Returns:
- An array of overriden attribute names. The result is never be null.
-
hasAttribute
Checks if the attribute name is defined in this class or in one of the super classes- Specified by:
hasAttribute
in interfaceAggregateClass
- Parameters:
attributeName
- aString
object- Returns:
- true if the given attribute name exists in this AggregateClass.
-
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
- Overrides:
includeClass
in classAbstractDataClassImpl
- Parameters:
other
- The data class that has to be checked for references- Returns:
true
if the data class contains a reference to the giveanotherClass
.
-
isAggregate
public boolean isAggregate()isAggregate.
- Specified by:
isAggregate
in interfaceDataClass
- Overrides:
isAggregate
in classAbstractDataClassImpl
- Returns:
true
if the data class can be casted toAggregateClass
-
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
- Overrides:
newObject
in classAbstractDataClassImpl
- 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
- Overrides:
getObjectClass
in classAbstractDataClassImpl
- Returns:
- Class of the corresponding data object
-
removeAttribute
removes the given attribute- Specified by:
removeAttribute
in interfaceAggregateClass
- Parameters:
attributeName
- aString
object- Throws:
IllegalEditException
- if any.
-
getAttributeProperty
public String getAttributeProperty(String attributeName, String propertyName) throws ProCAKENoSuchAttributeException Gets the value of the given property name for the given attribute. If the property does not exists, null will be returned.- Specified by:
getAttributeProperty
in interfaceAggregateClass
- Parameters:
attributeName
- aString
objectpropertyName
- aString
object- Returns:
- The value of the property or null, if the property does not exists.
- Throws:
ProCAKENoSuchAttributeException
- if any.- See Also:
-
getAttributePropertyNames
public String[] getAttributePropertyNames(String attributeName) throws ProCAKENoSuchAttributeException To receive all properties of an attribute that are set use this method. The result will never be null.- Specified by:
getAttributePropertyNames
in interfaceAggregateClass
- Parameters:
attributeName
- aString
object- Returns:
- All properties of the specified attribute. null will be never returned.
- Throws:
ProCAKENoSuchAttributeException
- if any.- See Also:
-
removeAttributeProperty
public String removeAttributeProperty(String attributeName, String propertyName) throws ProCAKENoSuchAttributeException A property for a given attribute can be removed by setting anull
property value or by using this method. In both cases the property is removed only if the property with the namepropertyName
exists.- Specified by:
removeAttributeProperty
in interfaceAggregateClass
- Parameters:
attributeName
- aString
objectpropertyName
- The name of the property that should be removed.- Returns:
- The value of the removed property or
null
if the property does not exist. - Throws:
ProCAKENoSuchAttributeException
-
addAttributeProperty
public void addAttributeProperty(String attributeName, PropertyTreeNode newNode) throws ProCAKENoSuchAttributeException addAttributeProperty.
- Specified by:
addAttributeProperty
in interfaceAggregateClass
- Parameters:
attributeName
- aString
objectnewNode
- aPropertyTreeNode
object- Throws:
ProCAKENoSuchAttributeException
-
addAttributeProperty
public void addAttributeProperty(String attributeName, String propertyName, String propertyValue) throws ProCAKENoSuchAttributeException Sets a new property value or overwrites an existing one for the given attribute with the valuepropertyValue
. IfpropertyName
isnull
nothing will happen. IfpropertyValue
isnull
, the property will be removed. This is the same like using the methodAggregateClass.removeAttributeProperty(String, String)
just without a return type.- Specified by:
addAttributeProperty
in interfaceAggregateClass
- Parameters:
attributeName
- aString
objectpropertyName
- aString
objectpropertyValue
- aString
object- Throws:
ProCAKENoSuchAttributeException
- if any.- See Also:
-
updateAttributeType
public void updateAttributeType(String attributeName, DataClass newType) throws IllegalEditException To change the type of the attribute call this message. If the attribute name does not exist, it will be automatically added.- Specified by:
updateAttributeType
in interfaceAggregateClass
- Parameters:
attributeName
- aString
objectnewType
- aDataClass
object- Throws:
IllegalEditException
- if any.
-
conformToModel
Checks all properties whether they conform to given model. IfDataClass
es are used which are present in the given model but with different reference, they will be replaced.- Parameters:
other
- The other data model to which this aggregate class should conform to
-