Class UnionClassImpl
- java.lang.Object
-
- de.uni_trier.wi2.procake.data.model.impl.AbstractDataClassImpl
-
- de.uni_trier.wi2.procake.data.model.base.impl.UnionClassImpl
-
- All Implemented Interfaces:
UnionClass,DataClass,PropertyHandler
public class UnionClassImpl extends AbstractDataClassImpl implements UnionClass
UnionClassImpl class.
- Author:
- Rainer Maximini
-
-
Field Summary
-
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
-
Fields inherited from interface de.uni_trier.wi2.procake.data.model.base.UnionClass
CLASS_NAME, COMPONENT, COMPONENT_KEY, LOG_EQUAL_ELEMENTCLASS, LOG_MISSING_ELEMENTCLASS
-
-
Constructor Summary
Constructors Constructor Description UnionClassImpl()Constructor for UnionClassImpl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(DataClass dataClass)Adds an additionalDataClassto the list of data classesvoidcheckFinishEditing()This method only checks if it is possible to finish the class and does not change any internal status.voidconformToModel(Model other)Checks the list of data classes whether they conform to given model.DataClasscreateSubclass(String name)This method creates none system sub classes that are defined by the user.protected voidcreateSystemSubClasses()createSystemSubClasses.DataClass[]getClasses()getClasses.booleanhasClass(DataClass dataClass)Checks if the givenDataClassdataClassis a member of the union.booleanincludeClass(DataClass other)This method checks if the data class contains a reference to another data class.booleanisUnion()isUnion.DataObjectnewObject()Creates a newDataObjectand initialize it.voidremove(DataClass dataClass)Removes aDataClassfrom the list of data classes.-
Methods inherited from class de.uni_trier.wi2.procake.data.model.impl.AbstractDataClassImpl
addProperty, addProperty, addSubclass, addSubClass, beSystemClass, checkEditability, checkInstantiability, clearSubClasses, createSystemClassTree, finishEditing, getAllProperties, getAllPropertyNodes, getModel, getName, getObjectClass, getProperty, getPropertyNames, getPropertyNode, getPropertyRootNode, getRootClass, getSubClasses, getSuperClass, getSuperClasses, getSystemClassName, getSystemSuperClass, hasProperties, isAbstract, isAdaptationCase, isAggregate, 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, 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, finishEditing, getModel, getName, getObjectClass, getSubClasses, getSuperClass, getSuperClasses, getSystemClassName, getSystemSuperClass, isAbstract, isAggregate, 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, 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
-
add
public void add(DataClass dataClass) throws IllegalEditException
Adds an additionalDataClassto the list of data classes- Specified by:
addin interfaceUnionClass- Parameters:
dataClass- The new data class. If the data class is already in the list the new one will be ignored.- Throws:
IllegalEditException
-
checkFinishEditing
public void checkFinishEditing() throws ClassHierarchyConsistencyExceptionThis method only checks if it is possible to finish the class and does not change any internal status. To initialize internal caches use the methodAbstractDataClassImpl.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
AbstractDataClassImpl.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 inAbstractDataClassImpl.finishEditing()where first the super class is called. For example:protected void checkFinishEditing() throws ClassHierarchyConsistencyException { super.checkFinishEditing(); // put your code here }- Overrides:
checkFinishEditingin classAbstractDataClassImpl- Throws:
ClassHierarchyConsistencyException- See Also:
AbstractDataClassImpl.finishEditing()
-
createSystemSubClasses
protected void createSystemSubClasses()
createSystemSubClasses.
- Specified by:
createSystemSubClassesin classAbstractDataClassImpl
-
getClasses
public DataClass[] getClasses()
getClasses.
- Specified by:
getClassesin interfaceUnionClass- Returns:
- an array of all
DataClasses. - See Also:
UnionClass.add(DataClass),UnionClass.remove(DataClass)
-
hasClass
public boolean hasClass(DataClass dataClass)
Checks if the givenDataClassdataClassis a member of the union.- Specified by:
hasClassin interfaceUnionClass- Parameters:
dataClass- TheDataClassthat should be checked.- Returns:
trueif thedataClassis a member of the union.
-
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.
-
isUnion
public boolean isUnion()
isUnion.
- Specified by:
isUnionin interfaceDataClass- Overrides:
isUnionin classAbstractDataClassImpl- Returns:
trueif the data class can be casted toUnionClass
-
remove
public void remove(DataClass dataClass) throws IllegalEditException
Removes aDataClassfrom the list of data classes. If the data class is not in the list of data classes nothing will happen.- Specified by:
removein interfaceUnionClass- Parameters:
dataClass- The data class that should be removed.- Throws:
IllegalEditException
-
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
-
createSubclass
public DataClass createSubclass(String name)
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.
- See Also:
Model.removeClass(String)
-
conformToModel
public void conformToModel(Model other)
Checks the list of data classes 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 union class should conform to
-
-