Interface IPModeManager

All Known Implementing Classes:
PModeManager, PModeManagerInMemory

public interface IPModeManager
Interface for a manager for PMode objects.
Author:
Philip Helger
  • 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.commons.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.commons.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.commons.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

      @Nullable default 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

      @Nonnull static Predicate<IPMode> getPModeFilter(@Nonnull String sID, @Nullable PModeParty aInitiator, @Nullable PModeParty aResponder)
      Get a predicate that matches a PMode by ID, initiator and responder.
      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.commons.collection.impl.ICommonsList<IPMode> getAll()
      Returns:
      A non-null but maybe empty list of all contained PModes.
    • getAllIDs

      @Nonnull com.helger.commons.collection.impl.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