Class CommonRules

java.lang.Object
com.apgar.common.lib.rules.CommonRules

public class CommonRules extends Object
This class allows to define common rules of the project.

It includes methods commonly used in triggers and in the implementation of business rules. These include:

  • Setting a record's meta data information
  • Setting a field's time and date
  • Getting the foreign key label for a record
  • Getting a path relative to its root
Author:
APGAR Consulting
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    doesActiveIndicatorHaveToBeSet(com.orchestranetworks.schema.trigger.TriggerSetupContext context)
    Checks whether the Active Indicator needs to be set.
    static String
    getFkLabel(com.onwbp.adaptation.Adaptation currRecord, com.orchestranetworks.schema.Path currPath, com.orchestranetworks.service.Session session)
    Gets foreign key label from record and path.
    static com.orchestranetworks.schema.Path
    getRelativePathToRoot(com.orchestranetworks.instance.ValueContext pContext)
    Gets Relative Path To Root.
    static String
    getUserWithSalutation(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.service.UserReference userReference, Locale locale)
    Gets the user with the salutation.
    static boolean
    isActive(com.onwbp.adaptation.Adaptation record)
    Checks if Active Indicator is Active.
    static void
    setActiveIndicator(com.orchestranetworks.service.ValueContextForUpdate vcfu)
    Sets the Active Indicator field.
    static void
    setCurrentDateTime(com.orchestranetworks.service.ValueContextForUpdate pValue, com.orchestranetworks.schema.Path pPath)
    Sets the date and current hour, minute, and seconds.
    static void
    setCurrentTime(com.orchestranetworks.service.ValueContextForUpdate pValue, com.orchestranetworks.schema.Path pPath)
    Sets the date of the day.
    static Date
    Sets the milliseconds to zero for a given date.
    static Date
    Sets the time to zero for a given date.
    static com.onwbp.adaptation.Adaptation
    setTrackingMetaDataInformations(com.onwbp.adaptation.Adaptation record, com.orchestranetworks.service.ProcedureContext procedureContext, com.orchestranetworks.service.Session session, com.orchestranetworks.schema.Path pathToParentSdlId, boolean isCreation)
    Allows setting the Meta Data Information in the Tracking tab depending on the type of flow.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • setTrackingMetaDataInformations

      public static com.onwbp.adaptation.Adaptation setTrackingMetaDataInformations(com.onwbp.adaptation.Adaptation record, com.orchestranetworks.service.ProcedureContext procedureContext, com.orchestranetworks.service.Session session, com.orchestranetworks.schema.Path pathToParentSdlId, boolean isCreation) throws com.orchestranetworks.service.OperationException
      Allows setting the Meta Data Information in the Tracking tab depending on the type of flow.
      Parameters:
      record - Record updated
      procedureContext - ProcedureContext
      session - Session
      pathToParentSdlId - Path
      isCreation - True if record is being created
      Returns:
      Adaptation modified record
      Throws:
      com.orchestranetworks.service.OperationException - Exception
    • getUserWithSalutation

      public static String getUserWithSalutation(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.service.UserReference userReference, Locale locale)
      Gets the user with the salutation.
      Parameters:
      repository - Repository
      userReference - UserReference
      locale - Locale
      Returns:
      String User ID
    • setCurrentTime

      public static void setCurrentTime(com.orchestranetworks.service.ValueContextForUpdate pValue, com.orchestranetworks.schema.Path pPath)
      Sets the date of the day.
      Parameters:
      pValue - ValueContextForUpdate
      pPath - Path the date will be set to
    • setCurrentDateTime

      public static void setCurrentDateTime(com.orchestranetworks.service.ValueContextForUpdate pValue, com.orchestranetworks.schema.Path pPath)
      Sets the date and current hour, minute, and seconds.
      Parameters:
      pValue - ValueContextForUpdate
      pPath - Path the date will be set to
    • doesActiveIndicatorHaveToBeSet

      public static boolean doesActiveIndicatorHaveToBeSet(com.orchestranetworks.schema.trigger.TriggerSetupContext context)
      Checks whether the Active Indicator needs to be set.
      Parameters:
      context - TriggerSetupContext
      Returns:
      boolean True if field needs to be set
    • setActiveIndicator

      public static void setActiveIndicator(com.orchestranetworks.service.ValueContextForUpdate vcfu)
      Sets the Active Indicator field.
      Parameters:
      vcfu - ValueContextForUpdate of the record the indicator will be set for
    • setTimeToZero

      public static Date setTimeToZero(Date date)
      Sets the time to zero for a given date.
      Parameters:
      date - Date where the time will be set to 0
      Returns:
      Date modified date
    • setMillisecondsToZero

      public static Date setMillisecondsToZero(Date date)
      Sets the milliseconds to zero for a given date.
      Parameters:
      date - Date where the milliseconds will be set to 0
      Returns:
      Date modified date
    • isActive

      public static boolean isActive(com.onwbp.adaptation.Adaptation record)
      Checks if Active Indicator is Active.
      Parameters:
      record - Adaptation
      Returns:
      true if Active Indicator is Active
    • getRelativePathToRoot

      public static com.orchestranetworks.schema.Path getRelativePathToRoot(com.orchestranetworks.instance.ValueContext pContext)
      Gets Relative Path To Root.
      Parameters:
      pContext - ValueContext
      Returns:
      Path the path relative to root
    • getFkLabel

      public static String getFkLabel(com.onwbp.adaptation.Adaptation currRecord, com.orchestranetworks.schema.Path currPath, com.orchestranetworks.service.Session session)
      Gets foreign key label from record and path.
      Parameters:
      currRecord - Current Record
      currPath - Current Path
      session - Session
      Returns:
      String FK Label as a String