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.
  • Field Details

    • logger

      protected static final Logger logger
      a Logger
  • Constructor Details

    • UpdateUserAttribute

      public UpdateUserAttribute()
  • Method Details

    • 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 by name with the value given by value in the template. A value of null for value signals that the attribute should be removed.
      Parameters:
      template - the template where the method is performed on
      attributeContainer - the container which holds the attribute name
      name - of the user attribute which is to be changed
      value - 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 by name with the value given by value in the template. A value of null for value 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 on
      attributeContainer - the container which holds the attribute name
      name - of the user attribute which is to be changed
      value - the new value for the user attribute or null
      checkReport - 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 by name with the value given by value in the instance. A value of null for value signals that the attribute should be removed.
      Parameters:
      instance - the changeable instance where the method is performed on
      attributeContainer - the container which holds the attribute name
      name - of the user attribute which is to be changed
      value - 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 by name with the value given by value in the instance. A value of null for value 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 on
      attributeContainer - the container which holds the attribute name
      name - of the user attribute which is to be changed
      value - the new value for the user attribute or null
      checkReport - 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 of value is null, the attribute is removed. User attribute containers are e.g. Node, Edge, DataElement, ...
      Parameters:
      template - the related template
      attributeContainer - 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 for value signals that the attribute should be removed. User attribute containers are e.g. Node, Edge, DataElement, ... (Method with updateManager)
      Parameters:
      template - the related template
      attributeContainer - 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 of value is null, the attribute is removed. User attribute containers are e.g. Node, Edge, DataElement, ...
      Parameters:
      instance - the related changeable instance
      attributeContainer - 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 of value is null, the attribute is removed. User attribute containers are e.g. Node, Edge, DataElement, ... (Method with updateManager)
      Parameters:
      instance - the related changeable instance
      attributeContainer - 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 ChangeableInstance
      attributeContainer - 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