Class UpdateUserAttribute
- java.lang.Object
-
- de.aristaflow.adept2.core.changeoperations.UpdateUserAttribute
-
public class UpdateUserAttribute extends Object
Change Operation to update a user attribute. Call isPossible first to check if the update is valid, than call perform operation to execute the change. FIXME new user attributes are added by using a name which is not contained in the userAttributeContainer. Deletion is done by giving null for the value argument. Is this the correct behaviour? TODO Refactor; use a common interface for change operations.
-
-
Constructor Summary
Constructors Constructor Description UpdateUserAttribute()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isPossible(ChangeableInstance instance, UserAttributeContainer attributeContainer, String name, String value)
Checks if it is valid (concerning structural and state-based correctness) to update the user attribute of UserAttributeContainer given byname
with the value given byvalue
in the instance.static boolean
isPossible(ChangeableInstance instance, UserAttributeContainer attributeContainer, String name, String value, CheckReport checkReport)
Checks if it is valid (concerning structural and state-based correctness) to update the user attribute of UserAttributeContainer given byname
with the value given byvalue
in the instance.static boolean
isPossible(Template template, UserAttributeContainer attributeContainer, String name, String value)
Checks if it is valid (concerning structural correctness) to update the user attribute of UserAttributeContainer given byname
with the value given byvalue
in the template.static boolean
isPossible(Template template, UserAttributeContainer attributeContainer, String name, String value, CheckReport checkReport)
Checks if it is valid (concerning structural correctness) to update the user attribute of UserAttributeContainer given byname
with the value given byvalue
in the template.static void
performOperation(ChangeableInstance instance, UserAttributeContainer attributeContainer, String name, String value)
Sets the value of the user defined attribute identified by name to value in the given template.static void
performOperation(ChangeableInstance instance, UserAttributeContainer attributeContainer, String name, String value, UpdateManager updateManager)
Sets the value of the user defined attribute identified by name to value in the given template.static void
performOperation(ChangeableTemplate template, UserAttributeContainer attributeContainer, String name, String value)
Sets the value of the user defined attribute identified by name to value in the given template.static void
performOperation(ChangeableTemplate template, UserAttributeContainer attributeContainer, String name, String value, UpdateManager updateManager)
Sets the value of the user defined attribute identified by name to value in the given template.protected static void
performOperation(ChangePrimitives processGraph, UserAttributeContainer attributeContainer, String name, String value, UpdateManager updateManager)
Worker method to do the structural changes for both changeable templates and changeable instances.
-
-
-
Field Detail
-
logger
protected static final Logger logger
a Logger
-
-
Method Detail
-
isPossible
public static boolean isPossible(Template template, UserAttributeContainer attributeContainer, String name, String value)
Checks if it is valid (concerning structural correctness) to update the user attribute of UserAttributeContainer given byname
with the value given byvalue
in the template. A value of null forvalue
signals that the attribute should be removed.- Parameters:
template
- the template where the method is performed onattributeContainer
- the container which holds the attributename
name
- of the user attribute which is to be changedvalue
- the new value for the user attribute or null- Returns:
- true if the update is valid
-
isPossible
public static boolean isPossible(Template template, UserAttributeContainer attributeContainer, String name, String value, CheckReport checkReport)
Checks if it is valid (concerning structural correctness) to update the user attribute of UserAttributeContainer given byname
with the value given byvalue
in the template. A value of null forvalue
signals that the attribute should be removed. If it is not possible the reasons are stored in the checkReport.- Parameters:
template
- the template where the method is performed onattributeContainer
- the container which holds the attributename
name
- of the user attribute which is to be changedvalue
- the new value for the user attribute or nullcheckReport
- a checkReport object which can be filled with the reason why the isPossible failed (i.e. in the case the method returns false), may be null- Returns:
- true if the update is valid
-
isPossible
public static boolean isPossible(ChangeableInstance instance, UserAttributeContainer attributeContainer, String name, String value)
Checks if it is valid (concerning structural and state-based correctness) to update the user attribute of UserAttributeContainer given byname
with the value given byvalue
in the instance. A value of null forvalue
signals that the attribute should be removed.- Parameters:
instance
- the changeable instance where the method is performed onattributeContainer
- the container which holds the attributename
name
- of the user attribute which is to be changedvalue
- the new value for the user attribute- Returns:
- true if the update is valid
-
isPossible
public static boolean isPossible(ChangeableInstance instance, UserAttributeContainer attributeContainer, String name, String value, CheckReport checkReport)
Checks if it is valid (concerning structural and state-based correctness) to update the user attribute of UserAttributeContainer given byname
with the value given byvalue
in the instance. A value of null forvalue
signals that the attribute should be removed. If it is not possible the reasons are stored in the checkReport.- Parameters:
instance
- the changeable instance where the method is performed onattributeContainer
- the container which holds the attributename
name
- of the user attribute which is to be changedvalue
- the new value for the user attribute or nullcheckReport
- a checkReport object which can be filled with the reason why the isPossible failed (i.e. in the case the method returns false), may be null- Returns:
- true if the update is valid
-
performOperation
public static void performOperation(ChangeableTemplate template, UserAttributeContainer attributeContainer, String name, String value)
Sets the value of the user defined attribute identified by name to value in the given template. If the value ofvalue
is null, the attribute is removed. User attribute containers are e.g. Node, Edge, DataElement, ...- Parameters:
template
- the related templateattributeContainer
- The attribute container.name
- The name of the user defined attribute to be modified.value
- The new value or null.
-
performOperation
public static void performOperation(ChangeableTemplate template, UserAttributeContainer attributeContainer, String name, String value, UpdateManager updateManager)
Sets the value of the user defined attribute identified by name to value in the given template. A value of null forvalue
signals that the attribute should be removed. User attribute containers are e.g. Node, Edge, DataElement, ... (Method with updateManager)- Parameters:
template
- the related templateattributeContainer
- The attribute container.name
- The name of the user defined attribute to be modified.value
- The new value or null.updateManager
- The UpdateManager where modifications are logged, may be null
-
performOperation
public static void performOperation(ChangeableInstance instance, UserAttributeContainer attributeContainer, String name, String value)
Sets the value of the user defined attribute identified by name to value in the given template. If the value ofvalue
is null, the attribute is removed. User attribute containers are e.g. Node, Edge, DataElement, ...- Parameters:
instance
- the related changeable instanceattributeContainer
- The attribute container.name
- The name of the user defined attribute to be modified.value
- The new value or null.
-
performOperation
public static void performOperation(ChangeableInstance instance, UserAttributeContainer attributeContainer, String name, String value, UpdateManager updateManager)
Sets the value of the user defined attribute identified by name to value in the given template. If the value ofvalue
is null, the attribute is removed. User attribute containers are e.g. Node, Edge, DataElement, ... (Method with updateManager)- Parameters:
instance
- the related changeable instanceattributeContainer
- The attribute container.name
- The name of the user defined attribute to be modified.value
- The new value or null.updateManager
- The UpdateManager where modifications are logged, may be null
-
performOperation
protected static void performOperation(ChangePrimitives processGraph, UserAttributeContainer attributeContainer, String name, String value, UpdateManager updateManager)
Worker method to do the structural changes for both changeable templates and changeable instances.- Parameters:
processGraph
- an instance of type ChangeableTemplate or ChangeableInstanceattributeContainer
- The attribute container.name
- The name of the user defined attribute to be modified.value
- The new value.updateManager
- The UpdateManager where modifications are logged, may be null
-
-