Interface IPModeManager

All Known Implementing Classes:
PModeManagerInMemory, PModeManagerXML

public interface IPModeManager
Interface for a manager for PMode objects.
Author:
Philip Helger
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    createOrUpdatePMode(@NonNull PMode aPMode)
    Create or update the provided PMode.
    void
    createPMode(@NonNull PMode aPMode)
    Create a new PMode.
    @NonNull com.helger.base.state.EChange
    deletePMode(@Nullable String sPModeID)
    Delete the provided PMode.
    @Nullable IPMode
    findFirst(@NonNull Predicate<? super IPMode> aFilter)
    Find the first PMode matching the provided filter.
    @NonNull com.helger.collection.commons.ICommonsList<IPMode>
     
    @NonNull com.helger.collection.commons.ICommonsSet<String>
     
    static @NonNull Predicate<IPMode>
    getPModeFilter(@NonNull String sID, @Nullable PModeParty aInitiator, @Nullable PModeParty aResponder)
    Get a predicate that matches a PMode by ID or initiator and responder together.
    @Nullable IPMode
    getPModeOfID(@Nullable String sID)
    Find the PMode with the provided ID
    default @Nullable IPMode
    getPModeOfServiceAndAction(@Nullable String sService, @Nullable String sAction)
    Find the first PMode that has the provided service and action.
    @NonNull com.helger.base.state.EChange
    markPModeDeleted(@Nullable String sPModeID)
    Mark the provided PMode as deleted.
    @NonNull com.helger.base.state.EChange
    updatePMode(@NonNull IPMode aPMode)
    Update an existing PMode.
    default void
    Validate all contained PModes at once.
    default void
    validatePMode(@Nullable IPMode aPMode)
    Validate, that the provided PMode domain object is consistent according to the underlying requirements.
  • Method Details

    • createPMode

      void createPMode(@NonNull PMode aPMode)
      Create a new PMode.
      Parameters:
      aPMode - The PMode to be created. May not be null.
    • updatePMode

      @NonNull com.helger.base.state.EChange updatePMode(@NonNull IPMode aPMode)
      Update an existing PMode.
      Parameters:
      aPMode - The PMode to be updated. May not be null.
      Returns:
      EChange.CHANGED if something changed, EChange.UNCHANGED otherwise.
    • createOrUpdatePMode

      void createOrUpdatePMode(@NonNull PMode aPMode)
      Create or update the provided PMode.
      Parameters:
      aPMode - The PMode to be created or updated.
    • markPModeDeleted

      @NonNull com.helger.base.state.EChange markPModeDeleted(@Nullable String sPModeID)
      Mark the provided PMode as deleted.
      Parameters:
      sPModeID - The ID of the PMode to be marked as deleted. May be null.
      Returns:
      EChange
    • deletePMode

      @NonNull com.helger.base.state.EChange deletePMode(@Nullable String sPModeID)
      Delete the provided PMode.
      Parameters:
      sPModeID - The ID of the PMode to be deleted. May be null.
      Returns:
      EChange
    • findFirst

      @Nullable IPMode findFirst(@NonNull Predicate<? super IPMode> aFilter)
      Find the first PMode matching the provided filter.
      Parameters:
      aFilter - The filter to be used. May not be null.
      Returns:
      null if no such PMode exists.
    • getPModeOfServiceAndAction

      default @Nullable IPMode getPModeOfServiceAndAction(@Nullable String sService, @Nullable String sAction)
      Find the first PMode that has the provided service and action.
      Parameters:
      sService - The service to be searched. May be null.
      sAction - The action to be searched. May be null.
      Returns:
      null if no such PMode exists.
    • getPModeFilter

      static @NonNull Predicate<IPMode> getPModeFilter(@NonNull String sID, @Nullable PModeParty aInitiator, @Nullable PModeParty aResponder)
      Get a predicate that matches a PMode by ID or initiator and responder together.
      Parameters:
      sID - PMode ID to search. May be null.
      aInitiator - Initiator to search. May be null.
      aResponder - Responder to search. May be null.
      Returns:
      Never null.
    • getPModeOfID

      @Nullable IPMode getPModeOfID(@Nullable String sID)
      Find the PMode with the provided ID
      Parameters:
      sID - The ID to search. May be null.
      Returns:
      null if no such PMode exists.
    • getAll

      @NonNull com.helger.collection.commons.ICommonsList<IPMode> getAll()
      Returns:
      A non-null but maybe empty list of all contained PModes.
    • getAllIDs

      @NonNull com.helger.collection.commons.ICommonsSet<String> getAllIDs()
      Returns:
      A non-null but maybe empty set of the IDs of all contained PModes.
    • validatePMode

      default void validatePMode(@Nullable IPMode aPMode) throws PModeValidationException
      Validate, that the provided PMode domain object is consistent according to the underlying requirements.
      Parameters:
      aPMode - The PMode to be validated. May be null.
      Throws:
      PModeValidationException - in case the PMode is invalid.
    • validateAllPModes

      default void validateAllPModes() throws PModeValidationException
      Validate all contained PModes at once.
      Throws:
      PModeValidationException - In case at least one PMode is invalid