Class UpdateParameterWorkflowUnit

  • All Implemented Interfaces:
    com.qfs.snl.workflows.units.IWorkflowUnit, com.quartetfs.fwk.types.IExtendedPluginValue, Serializable

    @QuartetExtendedPluginValue(intf=com.qfs.snl.workflows.units.IWorkflowUnit.class,
                                key="UpdateParameterWorkflowUnit")
    public class UpdateParameterWorkflowUnit
    extends Object
    implements com.qfs.snl.workflows.units.IWorkflowUnit
    Author:
    ActiveViam
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected com.qfs.repository.params.IParameterUpdate<com.qfs.repository.persistence.model.IPointValue,​com.qfs.repository.persistence.model.IPointValue> change
      The point values
      protected static String DAY_FORMAT
      Format string to display a day date
      static String KEY
      Key of the unit
      protected com.qfs.snl.workflows.IWorkflowPayload payload
      The payload
      protected com.qfs.repository.params.IParameterUpdate<com.qfs.repository.persistence.model.IPointValue.IKey,​com.qfs.repository.persistence.model.IPointValue.IKey> pendingChange
      The id's of the point values
      protected static String TIME_FORMAT
      Format string to display time from a date
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static String formatExpiration​(long time)
      Formats the expiration date of a parameter change.
      String getActivationPeriod​(com.qfs.repository.persistence.IUpdateRequest<? extends com.qfs.repository.persistence.model.IPointValue,​? extends com.qfs.repository.persistence.model.IPointValue> pointValue)
      Gets the activation period description for a point value update.
      String getActivationPeriod​(com.qfs.repository.persistence.model.IPointValue pointValue)
      Gets the activation period description for a point value.
      com.qfs.repository.params.IParameterUpdate<com.qfs.repository.persistence.model.IPointValue,​com.qfs.repository.persistence.model.IPointValue> getChange()
      Gets the change definition.
      protected String getParameterName()
      Gets the name of the parameter from the two possible change definitions.
      com.qfs.repository.params.IParameterUpdate<com.qfs.repository.persistence.model.IPointValue.IKey,​com.qfs.repository.persistence.model.IPointValue.IKey> getPendingChange()
      Gets the definition of the pending change.
      String getType()  
      protected com.qfs.repository.params.IParameterUpdate<com.qfs.repository.persistence.model.IPointValue.IKey,​com.qfs.repository.persistence.model.IPointValue> getUpdateDefinition()
      Gets the proper definition of the update from the received data.
      protected boolean hasChanges​(List<?> values)
      Decides if the list contains some changes.
      void notifyChange​(String initiator, com.qfs.snl.messages.IMessageService messageService)
      Notifies that a parameter changed.
      void notifyRejectedChange​(String initiator, com.qfs.snl.messages.IMessageService messageService)
      Notifies that a parameter change was rejected.
      void process​(com.qfs.snl.workflows.IWorkflowPayload payload)  
      void put​(com.qfs.repository.IRepositoryService repositoryService)
      Put as validated the changes in the repository service
      void putPending​(com.qfs.repository.IRepositoryService repositoryService)
      Put the the point values as pending
      void reject​(com.qfs.repository.IRepositoryService repositoryService)
      Rejects changes previously put as pending.
      void validate​(com.qfs.repository.IRepositoryService repositoryService)
      Validates changes previously put as pending.
    • Field Detail

      • payload

        protected com.qfs.snl.workflows.IWorkflowPayload payload
        The payload
      • change

        protected transient com.qfs.repository.params.IParameterUpdate<com.qfs.repository.persistence.model.IPointValue,​com.qfs.repository.persistence.model.IPointValue> change
        The point values
      • pendingChange

        protected com.qfs.repository.params.IParameterUpdate<com.qfs.repository.persistence.model.IPointValue.IKey,​com.qfs.repository.persistence.model.IPointValue.IKey> pendingChange
        The id's of the point values
    • Constructor Detail

      • UpdateParameterWorkflowUnit

        public UpdateParameterWorkflowUnit()
    • Method Detail

      • getType

        public String getType()
        Specified by:
        getType in interface com.quartetfs.fwk.types.IExtendedPluginValue
      • process

        public void process​(com.qfs.snl.workflows.IWorkflowPayload payload)
        Specified by:
        process in interface com.qfs.snl.workflows.units.IWorkflowUnit
      • hasChanges

        protected boolean hasChanges​(List<?> values)
        Decides if the list contains some changes.
        Parameters:
        values - change list
        Returns:
        true if the list is not null nor empty.
      • getChange

        public com.qfs.repository.params.IParameterUpdate<com.qfs.repository.persistence.model.IPointValue,​com.qfs.repository.persistence.model.IPointValue> getChange()
        Gets the change definition.
        Returns:
        the change
      • getPendingChange

        public com.qfs.repository.params.IParameterUpdate<com.qfs.repository.persistence.model.IPointValue.IKey,​com.qfs.repository.persistence.model.IPointValue.IKey> getPendingChange()
        Gets the definition of the pending change.
        Returns:
        the change
      • put

        public void put​(com.qfs.repository.IRepositoryService repositoryService)
        Put as validated the changes in the repository service
        Parameters:
        repositoryService - the repository service
      • putPending

        public void putPending​(com.qfs.repository.IRepositoryService repositoryService)
        Put the the point values as pending
        Parameters:
        repositoryService - the repository service
      • validate

        public void validate​(com.qfs.repository.IRepositoryService repositoryService)
        Validates changes previously put as pending.
        Parameters:
        repositoryService - repository service to use
      • reject

        public void reject​(com.qfs.repository.IRepositoryService repositoryService)
        Rejects changes previously put as pending.
        Parameters:
        repositoryService - repository service to use
      • formatExpiration

        public static String formatExpiration​(long time)
        Formats the expiration date of a parameter change.

        If the change occurs in the same day, this only returns the time. Otherwise, the whole date is returned.

        Parameters:
        time - the time at which the expiration occurs
        Returns:
        the formatted value for the expiration
      • getUpdateDefinition

        protected com.qfs.repository.params.IParameterUpdate<com.qfs.repository.persistence.model.IPointValue.IKey,​com.qfs.repository.persistence.model.IPointValue> getUpdateDefinition()
        Gets the proper definition of the update from the received data.
        Returns:
        the change to execute
      • getActivationPeriod

        public String getActivationPeriod​(com.qfs.repository.persistence.model.IPointValue pointValue)
        Gets the activation period description for a point value.
        Parameters:
        pointValue - the paint value to consider
        Returns:
        the string description
      • getActivationPeriod

        public String getActivationPeriod​(com.qfs.repository.persistence.IUpdateRequest<? extends com.qfs.repository.persistence.model.IPointValue,​? extends com.qfs.repository.persistence.model.IPointValue> pointValue)
        Gets the activation period description for a point value update.
        Parameters:
        pointValue - the update to consider
        Returns:
        the string description
      • notifyChange

        public void notifyChange​(String initiator,
                                 com.qfs.snl.messages.IMessageService messageService)
        Notifies that a parameter changed.
        Parameters:
        initiator - username of the author of the change
        messageService - service sending notifications
      • notifyRejectedChange

        public void notifyRejectedChange​(String initiator,
                                         com.qfs.snl.messages.IMessageService messageService)
        Notifies that a parameter change was rejected.
        Parameters:
        initiator - username of the author of the change
        messageService - service sending notifications
      • getParameterName

        protected String getParameterName()
        Gets the name of the parameter from the two possible change definitions.
        Returns:
        name of the changed parameter