Package com.apgar.common.lib.rules
Class CommonRules
java.lang.Object
com.apgar.common.lib.rules.CommonRules
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 TypeMethodDescriptionstatic booleandoesActiveIndicatorHaveToBeSet(com.orchestranetworks.schema.trigger.TriggerSetupContext context) Checks whether the Active Indicator needs to be set.static StringgetFkLabel(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.PathgetRelativePathToRoot(com.orchestranetworks.instance.ValueContext pContext) Gets Relative Path To Root.static StringgetUserWithSalutation(com.orchestranetworks.instance.Repository repository, com.orchestranetworks.service.UserReference userReference, Locale locale) Gets the user with the salutation.static booleanisActive(com.onwbp.adaptation.Adaptation record) Checks if Active Indicator is Active.static voidsetActiveIndicator(com.orchestranetworks.service.ValueContextForUpdate vcfu) Sets the Active Indicator field.static voidsetCurrentDateTime(com.orchestranetworks.service.ValueContextForUpdate pValue, com.orchestranetworks.schema.Path pPath) Sets the date and current hour, minute, and seconds.static voidsetCurrentTime(com.orchestranetworks.service.ValueContextForUpdate pValue, com.orchestranetworks.schema.Path pPath) Sets the date of the day.static DatesetMillisecondsToZero(Date date) Sets the milliseconds to zero for a given date.static DatesetTimeToZero(Date date) Sets the time to zero for a given date.static com.onwbp.adaptation.AdaptationsetTrackingMetaDataInformations(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.
-
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 updatedprocedureContext- ProcedureContextsession- SessionpathToParentSdlId- PathisCreation- 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- RepositoryuserReference- UserReferencelocale- 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- ValueContextForUpdatepPath- 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- ValueContextForUpdatepPath- 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
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
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 RecordcurrPath- Current Pathsession- Session- Returns:
- String FK Label as a String
-