Class PromotionObjectsValidator

All Implemented Interfaces:
UIComponentValidator, ValidationFilter

public class PromotionObjectsValidator extends DefaultUIComponentValidator
This class is used in the context of a data utility to return validation feedback messages. The feedback messages and feedback types are set on promotion target objects that are not valid for promote. If the promotion target will never be eligible for promotion given the current state for the object then the feedback type should be FAILURE, ERROR or WARNING. If the promotion target is not eligible for promotion because the selected promotion state is not valid and the promotion target could be promoted with a different selected state then the feedback type should be set to INFO.

Supported API: true
Extendable: true
  • Method Details

    • validateTarget

      protected UIValidationResult validateTarget(UIValidationKey validationKey, WTReference targetRef, Locale locale, FormDataHolder holder) throws WTException
      Validates the target reference object and generates any UIFeedbackMsgs when target reference is not valid. If the target reference is not valid for promotion the feed back message should be of type "WARNING" or "ERROR".

      Supported API: true
      Parameters:
      validationKey -
      targetRef -
      locale -
      Returns:
      result The UIValidationResult that could contain a UIFeedbackMsg.
      Throws:
      WTException
    • isValidPromoteContainer

      protected boolean isValidPromoteContainer(Persistable p, PromotionValidationFeedbackMsg msg, Locale locale, FormDataHolder holder)
      Check if the persistable is in a valid container

      Supported API: true
      Parameters:
      p - The persistable
      msg - The PromotionValidationFeedbackMsg that will be manipulated if needed.
      locale -
      Returns:
      isValidPromote boolean indicating valid container
    • checkForModifyOrSetState

      public void checkForModifyOrSetState(WTCollection persistables) throws WTException
      Will add object for the modifyPermissionMap. If the preference is not loaded or is true, it will check for the modify permission of the user on the given object, if the preference value is false there will be no check on modify permission and the object is eligible for promotion process. By default the preference value is true.

      Supported API:true
      Parameters:
      persistables - Collection of Persisatbles for promote
      Throws:
      WTException
    • isSelectedStateValid

      protected boolean isSelectedStateValid(Persistable promotableTarget, PromotionValidationFeedbackMsg msg, Locale locale)
      Given the promotion target checks if any of the states available for promotion equal the selected promotion state in the wizard. When there are no matching states to the one selected the feedback message is set and the feedback type is set to "WARNING" and PromoteConflictType.CLIENT.

      Supported API: true
      Parameters:
      promotableTarget -
      msg -
      locale -
      Returns:
      true if the promotableTarget has a valid promotion state