Class UpdateInstance


  • public class UpdateInstance
    extends Object
    Change Operation to update the properties of an instance. In contrast to other update operations, the instance update operation has the changeable attributes explicitly in its method signature. To be able to update not only all attributes the instance properties specify which of the given attributes are to be updated. Call isPossible first to check if the update is valid, then call perform operation to execute the change. TODO Refactor; use a common interface for change operations.
    • Field Detail

      • logger

        protected static final Logger logger
        aLogger
    • Constructor Detail

      • UpdateInstance

        public UpdateInstance()
    • Method Detail

      • isPossible

        public static boolean isPossible​(Instance instance,
                                         ProcessConstants.InstanceProperty... instanceProperties)
        TODO change instance to instance id if we have a process repository Checks if it is valid for the given instance to update the properties given by Properties. The following attributes / properties may be updated and must therefore be tested:
        • NAME
        • SUPERVISOR_AGENT
        • SUPERVISOR_ORG_POSITION
        • INITIATOR_AGENT
        • INITIATOR_ORG_POSITION
        • INPUT_PARAMETERS
        • OUTPUT_PARAMETERS
        Parameters:
        instance - the instance where the method is performed on
        instanceProperties - the properties which should be changed
        Returns:
        true if the change of the given properties are valid
      • isPossible

        public static boolean isPossible​(Instance instance,
                                         CheckReport checkReport,
                                         ProcessConstants.InstanceProperty... instanceProperties)
        TODO change instance to instance id if we have a process repository Checks if it is valid for the given instance to update the properties given by Properties. The following attributes / properties may be updated and must therefore be tested:
        • NAME
        • SUPERVISOR_AGENT
        • SUPERVISOR_ORG_POSITION
        • INITIATOR_AGENT
        • INITIATOR_ORG_POSITION
        • INPUT_PARAMETERS
        • OUTPUT_PARAMETERS
        Note: INPUT_PARAMETERS are normally not changeable since the start node is in state COMPLETED as soon as an instance is started. If it is not possible the reasons are stored in the checkReport.
        Parameters:
        instance - the instance where the method is performed on
        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
        instanceProperties - the properties which should be changed
        Returns:
        true if the change of the given properties are valid
      • performOperation

        public static void performOperation​(ChangeableInstance instance,
                                            String newName,
                                            QualifiedAgent newSupervisorAgent,
                                            Set<ProcessModelParameter> newInputParameters,
                                            Set<ProcessModelParameter> newOutputParameters,
                                            ProcessConstants.InstanceProperty... instanceProperties)
        Updates the given instance using those of the given attributes which are specified in instance properties. The following properties may be updated from the given object:
        • NAME
        • SUPERVISOR_AGENT
        • SUPERVISOR_ORG_POSITION
        • INITIATOR_AGENT
        • INITIATOR_ORG_POSITION
        • OUTPUT_PARAMETERS
        • INPUT_PARAMETERS
        Note: INPUT_PARAMETERS are normally not changeable since the start node is in state COMPLETED as soon as an instance is started. If it is not possible the reasons are stored in the checkReport.
        Parameters:
        instance - the instance whose properties are updated
        newName - the name of the instance (maybe null)
        newSupervisorAgent - the agent ID of the supervisor (maybe null)
        newInputParameters - the new input parameters of the instance (maybe null)
        newOutputParameters - the new output parameters of the instance (maybe null)
        instanceProperties - possible values of InstanceProperty are described above.
      • performOperation

        public static void performOperation​(ChangeableInstance instance,
                                            String newName,
                                            QualifiedAgent newSupervisorAgent,
                                            Set<ProcessModelParameter> newInputParameters,
                                            Set<ProcessModelParameter> newOutputParameters,
                                            UpdateManager updateManager,
                                            ProcessConstants.InstanceProperty... instanceProperties)
        Updates the given instance using those of the given attributes which are specified in instance properties. The following properties may be updated from the given object:
        • NAME
        • SUPERVISOR_AGENT
        • SUPERVISOR_ORG_POSITION
        • INITIATOR_AGENT
        • INITIATOR_ORG_POSITION
        • OUTPUT_PARAMETERS
        • INPUT_PARAMETERS
        Note: INPUT_PARAMETERS are normally not changeable since the start node is in state COMPLETED as soon as an instance is started. If it is not possible the reasons are stored in the checkReport.
        Parameters:
        instance - the instance whose properties are updated
        newName - the name of the instance (maybe null)
        newSupervisorAgent - the supervisor agent (maybe null)
        newInputParameters - the new input parameters of the instance (maybe null)
        newOutputParameters - the new output parameters of the instance (maybe null)
        updateManager - The update manager which will be informed about process changes.
        instanceProperties - possible values of InstanceProperty are described above.