Class AggregateClassImpl
- java.lang.Object
-
- de.uni_trier.wi2.procake.data.model.impl.AbstractDataClassImpl
-
- de.uni_trier.wi2.procake.data.model.base.impl.AggregateClassImpl
-
- All Implemented Interfaces:
AggregateClass,DataClass,PropertyHandler
public class AggregateClassImpl extends AbstractDataClassImpl implements AggregateClass
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, COMPONENT, COMPONENT_KEY, 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, COMPONENT, COMPONENT_KEY, 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
Constructors Modifier Constructor Description AggregateClassImpl()Constructor for AggregateClassImpl.protectedAggregateClassImpl(String name)Constructor for AggregateClassImpl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(String attributeName, DataClass attributeType)Adds an attribute an the end of the attribute list.voidaddAttributeProperty(String attributeName, PropertyTreeNode newNode)addAttributeProperty.voidaddAttributeProperty(String attributeName, String propertyName, String propertyValue)Sets a new property value or overwrites an existing one for the given attribute with the valuepropertyValue.voidconformToModel(Model other)Checks all properties whether they conform to given model.booleancontainsAttribute(String attributeName)Checks if the given attribute name is visible in this class.DataClasscreateSubclass(String name)This method creates none system sub classes that are defined by the user.protected voidcreateSystemSubClasses()createSystemSubClasses.voidfinishEditing()To instantiate classes it is necessary to know if the class can be edited further.List<AggregateClass.AttributeInfo>getAttributeInfos()getAttributeInfos.List<String>getAttributeNames()An array of all visible attributes should be returned.StringgetAttributeProperty(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.DataClassgetAttributeType(String attributeName)Determine the type of the specified attribute.String[]getInheritedAttributeNames()An array of all inherited attribute names.DataClassgetInheritedAttributeType(String attributeName)getInheritedAttributeType.String[]getLocalAttributeNames()An array of all local defined attribute names.DataClassgetLocalAttributeType(String attributeName)getLocalAttributeType.intgetNumberOfAttributes()getNumberOfAttributes() == getAttributeNames().size();intgetNumberOfLocalAttributes()getNumberOfLocalAttributes() == getLocalAttributeNames().size();Class<? extends DataObject>getObjectClass()getObjectClass.String[]getOverridenAttributeNames()An array of all local defined attribute names that override an attribute definition from one of the super classes.booleanhasAttribute(String attributeName)Checks if the attribute name is defined in this class or in one of the super classesbooleanincludeClass(DataClass other)This method checks if the data class contains a reference to another data class.booleanisAggregate()isAggregate.DataObjectnewObject()Creates a newDataObjectand initialize it.voidremoveAttribute(String attributeName)removes the given attributeStringremoveAttributeProperty(String attributeName, String propertyName)A property for a given attribute can be removed by setting anullproperty value or by using this method.voidupdateAttributeType(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, 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
-
-
-
-
Method Detail
-
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 aIllegalInstantiationExceptionwill be thrown.Each data class has a unique name. This name must be given to this method. If the name already exists, a
NameAlreadyExistsExceptionwill 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:
createSubclassin interfaceDataClass- Overrides:
createSubclassin classAbstractDataClassImpl- Parameters:
name- The uniqe name of the new sub class.- Returns:
- The new sub class.
- Throws:
IllegalInstantiationExceptionNameAlreadyExistsExceptionApplicationError- See Also:
Model.removeClass(String)
-
addAttribute
public void addAttribute(String attributeName, DataClass attributeType) throws NameAlreadyExistsException, IllegalEditException
Adds an attribute an the end of the attribute list.- Specified by:
addAttributein interfaceAggregateClass- Parameters:
attributeName- aStringobjectattributeType- aDataClassobject- Throws:
NameAlreadyExistsExceptionIllegalEditException- if any.
-
containsAttribute
public boolean containsAttribute(String attributeName)
Checks if the given attribute name is visible in this class.- Specified by:
containsAttributein interfaceAggregateClass- Parameters:
attributeName- aStringobject- Returns:
- true if the given attribute name exists in this or in one of the parent AggregateClasses.
-
createSystemSubClasses
protected void createSystemSubClasses()
createSystemSubClasses.
- Specified by:
createSystemSubClassesin classAbstractDataClassImpl
-
finishEditing
public void finishEditing() throws ClassHierarchyConsistencyExceptionTo 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:
finishEditingin interfaceDataClass- Overrides:
finishEditingin classAbstractDataClassImpl- Throws:
ClassHierarchyConsistencyException- if any.- See Also:
DataClass.finishEditing(),AbstractDataClassImpl.checkFinishEditing()
-
getAttributeNames
public List<String> 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:
getAttributeNamesin interfaceAggregateClass- Returns:
- An array of attribute names. The result is never be null.
-
getAttributeInfos
public List<AggregateClass.AttributeInfo> getAttributeInfos()
getAttributeInfos.
- Specified by:
getAttributeInfosin interfaceAggregateClass- Returns:
- A list of attribute informations.
-
getAttributeType
public DataClass getAttributeType(String attributeName)
Determine the type of the specified attribute. Warning: Only works on finished classes, returnsnullotherwise. To determine attribute-types in unfinished classes, callgetInheritedAttributeTypeorgetLocalAttributeType.- Specified by:
getAttributeTypein interfaceAggregateClass- Parameters:
attributeName- aStringobject- Returns:
- the type of the given attribute or null, if the attribute not exist
-
getInheritedAttributeNames
public String[] 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:
getInheritedAttributeNamesin interfaceAggregateClass- Returns:
- An array of inherited attribute names. The result is never be null.
-
getInheritedAttributeType
public DataClass getInheritedAttributeType(String attributeName)
getInheritedAttributeType.
- Specified by:
getInheritedAttributeTypein interfaceAggregateClass- Parameters:
attributeName- aStringobject- Returns:
- the type of the given attribute or null, if the attribute not exist in one of the parents
-
getLocalAttributeNames
public String[] 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:
getLocalAttributeNamesin interfaceAggregateClass- Returns:
- An array of local attribute names. The result is never be null.
-
getLocalAttributeType
public DataClass getLocalAttributeType(String attributeName)
getLocalAttributeType.
- Specified by:
getLocalAttributeTypein interfaceAggregateClass- Parameters:
attributeName- aStringobject- Returns:
- the type of the given attribute or null, if the attribute not exist
-
getNumberOfAttributes
public int getNumberOfAttributes()
getNumberOfAttributes() == getAttributeNames().size();- Specified by:
getNumberOfAttributesin interfaceAggregateClass- Returns:
- the number of visible attributes.
-
getNumberOfLocalAttributes
public int getNumberOfLocalAttributes()
getNumberOfLocalAttributes() == getLocalAttributeNames().size();- Specified by:
getNumberOfLocalAttributesin interfaceAggregateClass- Returns:
- the number of visible attributes.
-
getOverridenAttributeNames
public String[] 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:
getOverridenAttributeNamesin interfaceAggregateClass- Returns:
- An array of overriden attribute names. The result is never be null.
-
hasAttribute
public boolean hasAttribute(String attributeName)
Checks if the attribute name is defined in this class or in one of the super classes- Specified by:
hasAttributein interfaceAggregateClass- Parameters:
attributeName- aStringobject- Returns:
- true if the given attribute name exists in this AggregateClass.
-
includeClass
public boolean includeClass(DataClass other)
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 orCollectionClasses 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:
includeClassin interfaceDataClass- Overrides:
includeClassin classAbstractDataClassImpl- Parameters:
other- The data class that has to be checked for references- Returns:
trueif the data class contains a reference to the giveanotherClass.
-
isAggregate
public boolean isAggregate()
isAggregate.
- Specified by:
isAggregatein interfaceDataClass- Overrides:
isAggregatein classAbstractDataClassImpl- Returns:
trueif the data class can be casted toAggregateClass
-
newObject
public DataObject newObject() throws IllegalInstantiationException
Creates a newDataObjectand initialize it.DataObjects can not be created directly because they depend on theDataClassthat defines the object.The creation of a new object is only be possible if
DataClass.checkInstantiability()throws no exception.- Specified by:
newObjectin interfaceDataClass- Overrides:
newObjectin classAbstractDataClassImpl- 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:
getObjectClassin interfaceDataClass- Overrides:
getObjectClassin classAbstractDataClassImpl- Returns:
- Class of the corresponding data object
-
removeAttribute
public void removeAttribute(String attributeName) throws IllegalEditException
removes the given attribute- Specified by:
removeAttributein interfaceAggregateClass- Parameters:
attributeName- aStringobject- Throws:
IllegalEditException- if any.
-
getAttributeProperty
public String getAttributeProperty(String attributeName, String propertyName) throws NoSuchAttributeException
Gets the value of the given property name for the given attribute. If the property does not exists, null will be returned.- Specified by:
getAttributePropertyin interfaceAggregateClass- Parameters:
attributeName- aStringobjectpropertyName- aStringobject- Returns:
- The value of the property or null, if the property does not exists.
- Throws:
NoSuchAttributeException- if any.- See Also:
will be thrown.
-
getAttributePropertyNames
public String[] getAttributePropertyNames(String attributeName) throws NoSuchAttributeException
To receive all properties of an attribute that are set use this method. The result will never be null.- Specified by:
getAttributePropertyNamesin interfaceAggregateClass- Parameters:
attributeName- aStringobject- Returns:
- All properties of the specified attribute. null will be never returned.
- Throws:
NoSuchAttributeException- if any.- See Also:
will be thrown.
-
removeAttributeProperty
public String removeAttributeProperty(String attributeName, String propertyName) throws NoSuchAttributeException
A property for a given attribute can be removed by setting anullproperty value or by using this method. In both cases the property is removed only if the property with the namepropertyNameexists.- Specified by:
removeAttributePropertyin interfaceAggregateClass- Parameters:
attributeName- aStringobjectpropertyName- The name of the property that should be removed.- Returns:
- The value of the removed property or
nullif the property does not exist. - Throws:
NoSuchAttributeException
-
addAttributeProperty
public void addAttributeProperty(String attributeName, PropertyTreeNode newNode) throws NoSuchAttributeException
addAttributeProperty.
- Specified by:
addAttributePropertyin interfaceAggregateClass- Parameters:
attributeName- aStringobjectnewNode- aPropertyTreeNodeobject- Throws:
NoSuchAttributeException
-
addAttributeProperty
public void addAttributeProperty(String attributeName, String propertyName, String propertyValue) throws NoSuchAttributeException
Sets a new property value or overwrites an existing one for the given attribute with the valuepropertyValue. IfpropertyNameisnullnothing will happen. IfpropertyValueisnull, the property will be removed. This is the same like using the methodAggregateClass.removeAttributeProperty(String, String)just without a return type.- Specified by:
addAttributePropertyin interfaceAggregateClass- Parameters:
attributeName- aStringobjectpropertyName- aStringobjectpropertyValue- aStringobject- Throws:
NoSuchAttributeException- if any.- See Also:
will be thrown.
-
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:
updateAttributeTypein interfaceAggregateClass- Parameters:
attributeName- aStringobjectnewType- aDataClassobject- Throws:
IllegalEditException- if any.
-
conformToModel
public void conformToModel(Model other)
Checks all properties whether they conform to given model. IfDataClasses 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
-
-