ucot.model.object
Class ObjectAnalyzeModelEditor

java.lang.Object
  extended by ucot.model.object.ObjectAnalyzeModelEditor
All Implemented Interfaces:
java.io.Serializable, ModelEditor

public class ObjectAnalyzeModelEditor
extends java.lang.Object
implements ModelEditor, java.io.Serializable

Editor for the ObjectAnalyzeModel.

Author:
pajumasu
See Also:
Serialized Form

Field Summary
(package private)  ObjectAnalyzeModel model
           
static long serialVersionUID
           
(package private)  java.util.List<Updation> updations
           
 
Constructor Summary
ObjectAnalyzeModelEditor(ObjectAnalyzeModel model)
           
 
Method Summary
 void addAttribute(java.lang.String entityName, java.lang.String attributeName)
          Adds attribute to the entity.
 void addChild(java.lang.String entityName, java.lang.String childEntity)
          Adds child to the entity.
 void addEntity(java.lang.String name)
          Adds an entity to the model.
 void addEntityInfluenceByMethod(java.lang.String entityName, java.lang.String methodName, java.lang.String influencedEntity)
          Adds an influence between entity's method and the given entity.
 void addMethod(java.lang.String entityName, java.lang.String methodName)
          Add method to the entity.
 void addParent(java.lang.String entityName, java.lang.String parentEntity)
          Adds parent to the entity.
 void changeEntityName(java.lang.String oldName, java.lang.String newName)
          Changes the name of the entity.
 void changeMethodName(java.lang.String entityName, java.lang.String methodOldName, java.lang.String methodNewName)
          Changes method name.
 void clearModel()
          Clears model and makes it empty.
 boolean containsAttribute(java.lang.String entityName, java.lang.String attributeName)
          Checks wheter the entity contains the attribute or not.
 boolean containsEntity(java.lang.String entityName)
          Does the model contain the entity?
 boolean containsMethod(java.lang.String entityName, java.lang.String methodName)
          Checks if the given method exists in the entity
 boolean execute(Updation updation)
          Executes action defined by updaton object.
 java.lang.String getAttributeFromCardinal(java.lang.String entityName, java.lang.String attributeName)
          Gets from part of the cardinality of the attribute relation.
 java.util.Set<java.lang.String> getAttributeNames(java.lang.String entityName)
          Returns the attributes of the entity.
 java.lang.String getAttributeToCardinal(java.lang.String entityName, java.lang.String attributeName)
          Gets to part of the cardinality of the attribute relation.
 java.util.Set<java.lang.String> getChildren(java.lang.String entityName)
          Returns the names of the entity's children.
 java.util.Set<java.lang.String> getEntitiesInfluencedByMethod(java.lang.String entityName, java.lang.String methodName)
          Returns set of entities that are refered by methods in the model.
 java.util.Set<java.lang.String> getEntityNames()
           
 java.lang.String getEntityType(java.lang.String name)
          Returns the type of the entity.
 java.util.Set<java.lang.String> getMethodNames(java.lang.String entityName)
          Returns the names of the entity's methods.
 java.util.Set<java.lang.String> getParents(java.lang.String entityName)
          Returns the parents of the entity.
 java.util.List<Updation> getUpdations()
          Get updations done to this analyzemodel.
 void merge(AnalyzeModel fromModel)
          Merges given AnalyzeModel to the model that this editor modifies.
 void mergeEntity(java.lang.String targetEntityName, java.util.Set<java.lang.String> mergeSet)
          Merges entities to one entity.
 void removeAllChildren(java.lang.String entityName)
          Removes all the children from the entity.
 void removeAllParents(java.lang.String entityName)
          Removes all the parents of the entity.
 void removeAttribute(java.lang.String entityName, java.lang.String attributeName)
          Removes attribute from the entity.
 void removeChild(java.lang.String entityName, java.lang.String childEntity)
          Removes given child from the entity.
 void removeEntity(java.lang.String name)
          Removes entity from model.
 void removeEntityInfluenceByMethod(java.lang.String entityName, java.lang.String methodName, java.lang.String influencedEntity)
          Removes influnce between entity's method and the given entity.
 void removeMethod(java.lang.String entityName, java.lang.String methodName)
          Removes method from the entity.
 void removeParent(java.lang.String entityName, java.lang.String parentEntity)
          Removes given parent from the entity.
private  void sendUpdation(Updation updation)
           
 void setAttributeFromCardinal(java.lang.String entityName, java.lang.String attributeName, java.lang.String cardinal)
          Sets the cardinality on the entitys side.
 void setAttributeToCardinal(java.lang.String entityName, java.lang.String attributeName, java.lang.String cardinal)
          Sets the cardinality on attributes side.
 void setEntityType(java.lang.String name, java.lang.String entityType)
          Sets the type of the entity.
 void stepBack(int steps)
          Undoes some edition steps.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values

model

ObjectAnalyzeModel model

updations

java.util.List<Updation> updations
Constructor Detail

ObjectAnalyzeModelEditor

public ObjectAnalyzeModelEditor(ObjectAnalyzeModel model)
Method Detail

sendUpdation

private void sendUpdation(Updation updation)

clearModel

public void clearModel()
Description copied from interface: ModelEditor
Clears model and makes it empty.

Specified by:
clearModel in interface ModelEditor

getEntityNames

public java.util.Set<java.lang.String> getEntityNames()
Specified by:
getEntityNames in interface ModelEditor
Returns:
the names of the entities that the model contains.

getEntityType

public java.lang.String getEntityType(java.lang.String name)
Description copied from interface: ModelEditor
Returns the type of the entity.

Specified by:
getEntityType in interface ModelEditor
Parameters:
name - The name of the entity.
Returns:
The type of the entity.

setEntityType

public void setEntityType(java.lang.String name,
                          java.lang.String entityType)
Description copied from interface: ModelEditor
Sets the type of the entity.

Specified by:
setEntityType in interface ModelEditor
Parameters:
name - The name of the entity.
entityType - The type

addEntity

public void addEntity(java.lang.String name)
Description copied from interface: ModelEditor
Adds an entity to the model.

Specified by:
addEntity in interface ModelEditor
Parameters:
name - The name of the entity.

removeEntity

public void removeEntity(java.lang.String name)
Description copied from interface: ModelEditor
Removes entity from model.

Specified by:
removeEntity in interface ModelEditor
Parameters:
name - The name of the entity.

changeEntityName

public void changeEntityName(java.lang.String oldName,
                             java.lang.String newName)
Description copied from interface: ModelEditor
Changes the name of the entity.

Specified by:
changeEntityName in interface ModelEditor
Parameters:
oldName - The entity name that is going to be changed.
newName - The new name for that entity.

containsEntity

public boolean containsEntity(java.lang.String entityName)
Description copied from interface: ModelEditor
Does the model contain the entity?

Specified by:
containsEntity in interface ModelEditor
Parameters:
entityName - The name of the entity which existence is checked.
Returns:
true if exists false if does not.

addParent

public void addParent(java.lang.String entityName,
                      java.lang.String parentEntity)
Description copied from interface: ModelEditor
Adds parent to the entity.

Specified by:
addParent in interface ModelEditor
Parameters:
entityName - The name of the child entity.
parentEntity - The name of the parent entity.

removeParent

public void removeParent(java.lang.String entityName,
                         java.lang.String parentEntity)
Description copied from interface: ModelEditor
Removes given parent from the entity.

Specified by:
removeParent in interface ModelEditor
Parameters:
entityName - The name of the child entity.
parentEntity - The name of the parent entity.

removeAllParents

public void removeAllParents(java.lang.String entityName)
Description copied from interface: ModelEditor
Removes all the parents of the entity.

Specified by:
removeAllParents in interface ModelEditor
Parameters:
entityName - the name of the entity.

getParents

public java.util.Set<java.lang.String> getParents(java.lang.String entityName)
Description copied from interface: ModelEditor
Returns the parents of the entity.

Specified by:
getParents in interface ModelEditor
Parameters:
entityName - The name of the entity.
Returns:
The parents of the given entity.

addChild

public void addChild(java.lang.String entityName,
                     java.lang.String childEntity)
Description copied from interface: ModelEditor
Adds child to the entity.

Specified by:
addChild in interface ModelEditor
Parameters:
entityName - The name of parent entity.
childEntity - The name of the child.

removeChild

public void removeChild(java.lang.String entityName,
                        java.lang.String childEntity)
Description copied from interface: ModelEditor
Removes given child from the entity.

Specified by:
removeChild in interface ModelEditor
Parameters:
entityName - The entity.
childEntity - The child to be removed.

removeAllChildren

public void removeAllChildren(java.lang.String entityName)
Description copied from interface: ModelEditor
Removes all the children from the entity.

Specified by:
removeAllChildren in interface ModelEditor

getChildren

public java.util.Set<java.lang.String> getChildren(java.lang.String entityName)
Description copied from interface: ModelEditor
Returns the names of the entity's children.

Specified by:
getChildren in interface ModelEditor
Parameters:
entityName - The name of the entity.
Returns:
The child of the given entity.

addMethod

public void addMethod(java.lang.String entityName,
                      java.lang.String methodName)
Description copied from interface: ModelEditor
Add method to the entity.

Specified by:
addMethod in interface ModelEditor
Parameters:
entityName - The name of the entity.
methodName - The name of the method.

removeMethod

public void removeMethod(java.lang.String entityName,
                         java.lang.String methodName)
Description copied from interface: ModelEditor
Removes method from the entity.

Specified by:
removeMethod in interface ModelEditor
Parameters:
entityName - The entity which owns the method.
methodName - The name of the method.

changeMethodName

public void changeMethodName(java.lang.String entityName,
                             java.lang.String methodOldName,
                             java.lang.String methodNewName)
Description copied from interface: ModelEditor
Changes method name.

Specified by:
changeMethodName in interface ModelEditor
Parameters:
entityName - The name of the entity.

containsMethod

public boolean containsMethod(java.lang.String entityName,
                              java.lang.String methodName)
Description copied from interface: ModelEditor
Checks if the given method exists in the entity

Specified by:
containsMethod in interface ModelEditor
Parameters:
entityName - The name of the entity
methodName - The name of the method.
Returns:
True if the entity has given method.

getMethodNames

public java.util.Set<java.lang.String> getMethodNames(java.lang.String entityName)
Description copied from interface: ModelEditor
Returns the names of the entity's methods.

Specified by:
getMethodNames in interface ModelEditor
Parameters:
entityName - The name of the entity
Returns:
The entity's methods' names.

getEntitiesInfluencedByMethod

public java.util.Set<java.lang.String> getEntitiesInfluencedByMethod(java.lang.String entityName,
                                                                     java.lang.String methodName)
Description copied from interface: ModelEditor
Returns set of entities that are refered by methods in the model. For example sentence: A makes B can be interpereted so that make-method of entity A referes the entity B.

Specified by:
getEntitiesInfluencedByMethod in interface ModelEditor
Parameters:
entityName - The name of the entity that owns the method.
methodName - The methods name.
Returns:
Set of entity names that are refered by the method in some way.

addEntityInfluenceByMethod

public void addEntityInfluenceByMethod(java.lang.String entityName,
                                       java.lang.String methodName,
                                       java.lang.String influencedEntity)
Description copied from interface: ModelEditor
Adds an influence between entity's method and the given entity.

Specified by:
addEntityInfluenceByMethod in interface ModelEditor
Parameters:
entityName - The name of the entity that owns the method.
methodName - The methods name.
See Also:
ModelEditor.getEntitiesInfluencedByMethod(String, String)

removeEntityInfluenceByMethod

public void removeEntityInfluenceByMethod(java.lang.String entityName,
                                          java.lang.String methodName,
                                          java.lang.String influencedEntity)
Description copied from interface: ModelEditor
Removes influnce between entity's method and the given entity.

Specified by:
removeEntityInfluenceByMethod in interface ModelEditor
Parameters:
entityName - The name of the entity that owns the method.
methodName - The methods name.
influencedEntity - The name of the method that is influenced by the given method.
See Also:
ModelEditor.getEntitiesInfluencedByMethod(String, String)

addAttribute

public void addAttribute(java.lang.String entityName,
                         java.lang.String attributeName)
Description copied from interface: ModelEditor
Adds attribute to the entity.

Specified by:
addAttribute in interface ModelEditor
Parameters:
entityName - The name of the entity.
attributeName - The name of the attribute.

removeAttribute

public void removeAttribute(java.lang.String entityName,
                            java.lang.String attributeName)
Description copied from interface: ModelEditor
Removes attribute from the entity.

Specified by:
removeAttribute in interface ModelEditor
Parameters:
entityName - The name of the entity.
attributeName - The name of the attribute.

containsAttribute

public boolean containsAttribute(java.lang.String entityName,
                                 java.lang.String attributeName)
Description copied from interface: ModelEditor
Checks wheter the entity contains the attribute or not.

Specified by:
containsAttribute in interface ModelEditor
Parameters:
entityName - The name of the entity.
attributeName - The name of the attribute.
Returns:
True if contains.

getAttributeFromCardinal

public java.lang.String getAttributeFromCardinal(java.lang.String entityName,
                                                 java.lang.String attributeName)
Description copied from interface: ModelEditor
Gets from part of the cardinality of the attribute relation. From part means the cardinality on the entity's side that owns the attribute.

Specified by:
getAttributeFromCardinal in interface ModelEditor
Parameters:
entityName - The name of the entity.
attributeName - The name of the attibute.
Returns:
The cardinality value of the from part of the cardinal relation.

getAttributeToCardinal

public java.lang.String getAttributeToCardinal(java.lang.String entityName,
                                               java.lang.String attributeName)
Description copied from interface: ModelEditor
Gets to part of the cardinality of the attribute relation. To part means the cardinality on the attributes side.

Specified by:
getAttributeToCardinal in interface ModelEditor
Parameters:
entityName - The name of the entity.
attributeName - The name of the attibute.
Returns:
The cardinality value of the to part of the cardinal relation.

setAttributeFromCardinal

public void setAttributeFromCardinal(java.lang.String entityName,
                                     java.lang.String attributeName,
                                     java.lang.String cardinal)
Description copied from interface: ModelEditor
Sets the cardinality on the entitys side.

Specified by:
setAttributeFromCardinal in interface ModelEditor
Parameters:
entityName - The name of the entity.
attributeName - The name of the attibute.
cardinal - The cardinality value.

setAttributeToCardinal

public void setAttributeToCardinal(java.lang.String entityName,
                                   java.lang.String attributeName,
                                   java.lang.String cardinal)
Description copied from interface: ModelEditor
Sets the cardinality on attributes side.

Specified by:
setAttributeToCardinal in interface ModelEditor
Parameters:
entityName - The name of the entity.
attributeName - The name of the attibute.
cardinal - The cardinality value.

getAttributeNames

public java.util.Set<java.lang.String> getAttributeNames(java.lang.String entityName)
Description copied from interface: ModelEditor
Returns the attributes of the entity.

Specified by:
getAttributeNames in interface ModelEditor
Parameters:
entityName - The name of the entity.
Returns:
The attributes.

merge

public void merge(AnalyzeModel fromModel)
Description copied from interface: ModelEditor
Merges given AnalyzeModel to the model that this editor modifies. This only adds things that do not yet exist in the current model. Nothing is delted or modified.

Specified by:
merge in interface ModelEditor
Parameters:
fromModel - The analyze model beign merged.

getUpdations

public java.util.List<Updation> getUpdations()
Description copied from interface: ModelEditor
Get updations done to this analyzemodel.

Specified by:
getUpdations in interface ModelEditor
Returns:
List of Updations or null if this feature is not supported.

stepBack

public void stepBack(int steps)
Description copied from interface: ModelEditor
Undoes some edition steps.

Specified by:
stepBack in interface ModelEditor
Parameters:
steps - to undo

execute

public boolean execute(Updation updation)
Description copied from interface: ModelEditor
Executes action defined by updaton object.

Specified by:
execute in interface ModelEditor
Returns:
true if success, false if did not.

mergeEntity

public void mergeEntity(java.lang.String targetEntityName,
                        java.util.Set<java.lang.String> mergeSet)
Description copied from interface: ModelEditor
Merges entities to one entity. If given entity name (targetEntityName) does not exists it is created.

Specified by:
mergeEntity in interface ModelEditor
Parameters:
targetEntityName - The name of the entity after merge.
mergeSet - The set of entity names that are going to be merged.