Class RnCUtil
- java.lang.Object
-
- com.adobe.aem.formsndocuments.util.RnCUtil
-
public class RnCUtil extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringASSET_PATHstatic java.lang.StringPROJECT_SUB_TYPEstatic java.lang.StringPROJECT_TYPEstatic java.lang.StringREVIEW_CONTAINER_NODE_NAMEstatic java.lang.StringREVIEW_DEADLINEstatic java.lang.StringREVIEW_DESCRIPTIONstatic java.lang.StringREVIEW_GROUPstatic java.lang.StringREVIEW_IDstatic java.lang.StringREVIEW_INITIATORstatic java.lang.StringREVIEW_NAMEstatic java.lang.StringREVIEW_PROJECT_NAMEstatic java.lang.StringREVIEW_TASKS_PATHstatic java.lang.StringREVIEWERSstatic java.lang.StringTASK_DUE_DATEstatic java.lang.StringUNDER_REVIEW
-
Constructor Summary
Constructors Constructor Description RnCUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddUserToGroup(java.lang.String reviewer, java.lang.String reviewGroupId, ResourceResolver resourceResolver)Adds the user as member of group.static voidcheckAssetPathArgument(java.lang.String assetPath)Checks whether the asset path passed as argument is valid or not.static voidcheckCreateReviewArguments(java.lang.String reviewName, java.lang.String[] reviewerList, java.lang.String deadline, ResourceResolver resourceResolver)Checks whether the arguments passed for review creation are valid or not.static javax.jcr.NodecheckNodeExistance(java.lang.String assetPath, ResourceResolver resourceResolver)Checks whether the node exist on asset path passed as argument or not.static voidcheckReviewDeadlineArgument(java.lang.String deadline)Checks whether the deadline argument passed for review updation is valid or not.static voidcheckUpdateReviewArguments(java.lang.String[] reviewerList, java.lang.String deadline, ResourceResolver bundleResourceResolver)Checks whether the arguments passed for review updation are valid or not.static GroupcreateGroup(java.lang.String groupName, java.lang.String relativePath, ResourceResolver resourceResolver)Creates a user group with the name provided.static TaskcreateProject(java.lang.String reviewName, java.lang.String assetPath, java.lang.String deadline, java.lang.String assignee, ResourceResolver bundleResourceResolver, ResourceResolver resourceResolver)Creates the Task of type Projectstatic TaskcreateTask(java.lang.String reviewProjectName, java.lang.String reviewName, java.lang.String deadline, java.lang.String reviewer, java.lang.String assetPath, java.lang.String reviewDescription, ResourceResolver bundleResourceResolver, ResourceResolver resourceResolver)Creates a Task with given attributestatic java.util.List<java.lang.String>getGroupMembers(java.lang.String groupId, ResourceResolver resourceResolver)Returns the members of the specified group.static javax.jcr.NodegetNode(java.lang.String assetPath, ResourceResolver resourceResolver)Returns the node for the given repository path.static java.util.List<Task>getProjectSubTasks(java.lang.String reviewProjectName, ResourceResolver resourceResolver)Returns the project sub tasks.static ResourceResolvergetResourceResolver(javax.jcr.Session session, ResourceResolverFactory resourceResolverFactory)Returns the resource resolver for the session.static booleanisInArray(java.lang.String searchId, java.lang.String[] idArray)Checks whether the given id is in the given array.static java.lang.BooleanisMemberOfGroup(java.lang.String groupId, java.lang.String userId, ResourceResolver resourceResolver)Checks whether the user is member of group or not.static booleanisTaskEligibleForUpdate(Status status)Decides whether the task status passed, makes the task eligible for update or not.static voidremoveGroup(java.lang.String groupName, ResourceResolver resourceResolver)Removes the user group whose ID is given.static voidremoveUserFromGroup(java.lang.String reviewer, java.lang.String reviewGroupId, ResourceResolver resourceResolver)Removes the member from group.static voidterminateProjectActiveTasks(java.lang.String reviewProjectName, ResourceResolver resourceResolver)Completes the Project if its Active.static voidupdateProjectDeadline(java.lang.String reviewProjectName, java.lang.String deadline, ResourceResolver resourceResolver)Updates the deadline of Project if its not already completed.static voidupdateProjectDescription(java.lang.String reviewProjectName, java.lang.String description, ResourceResolver resourceResolver)Updates the description of Project if its not already completed.
-
-
-
Field Detail
-
PROJECT_TYPE
public static final java.lang.String PROJECT_TYPE
- See Also:
- Constant Field Values
-
PROJECT_SUB_TYPE
public static final java.lang.String PROJECT_SUB_TYPE
- See Also:
- Constant Field Values
-
TASK_DUE_DATE
public static final java.lang.String TASK_DUE_DATE
- See Also:
- Constant Field Values
-
ASSET_PATH
public static final java.lang.String ASSET_PATH
- See Also:
- Constant Field Values
-
REVIEWERS
public static final java.lang.String REVIEWERS
- See Also:
- Constant Field Values
-
REVIEW_NAME
public static final java.lang.String REVIEW_NAME
- See Also:
- Constant Field Values
-
REVIEW_ID
public static final java.lang.String REVIEW_ID
- See Also:
- Constant Field Values
-
REVIEW_INITIATOR
public static final java.lang.String REVIEW_INITIATOR
- See Also:
- Constant Field Values
-
REVIEW_DESCRIPTION
public static final java.lang.String REVIEW_DESCRIPTION
- See Also:
- Constant Field Values
-
REVIEW_PROJECT_NAME
public static final java.lang.String REVIEW_PROJECT_NAME
- See Also:
- Constant Field Values
-
REVIEW_GROUP
public static final java.lang.String REVIEW_GROUP
- See Also:
- Constant Field Values
-
REVIEW_DEADLINE
public static final java.lang.String REVIEW_DEADLINE
- See Also:
- Constant Field Values
-
UNDER_REVIEW
public static final java.lang.String UNDER_REVIEW
- See Also:
- Constant Field Values
-
REVIEW_CONTAINER_NODE_NAME
public static final java.lang.String REVIEW_CONTAINER_NODE_NAME
- See Also:
- Constant Field Values
-
REVIEW_TASKS_PATH
public static final java.lang.String REVIEW_TASKS_PATH
- See Also:
- Constant Field Values
-
-
Method Detail
-
isTaskEligibleForUpdate
public static boolean isTaskEligibleForUpdate(Status status)
Decides whether the task status passed, makes the task eligible for update or not.- Parameters:
status- task status- Returns:
- boolean
-
isMemberOfGroup
public static java.lang.Boolean isMemberOfGroup(java.lang.String groupId, java.lang.String userId, ResourceResolver resourceResolver) throws FormsNDocumentsException, javax.jcr.RepositoryExceptionChecks whether the user is member of group or not.- Parameters:
groupId-userId-resourceResolver-- Returns:
- Throws:
FormsNDocumentsExceptionjavax.jcr.RepositoryException
-
getGroupMembers
public static java.util.List<java.lang.String> getGroupMembers(java.lang.String groupId, ResourceResolver resourceResolver) throws FormsNDocumentsException, javax.jcr.RepositoryExceptionReturns the members of the specified group.- Parameters:
groupId-resourceResolver-- Returns:
- Throws:
FormsNDocumentsExceptionjavax.jcr.RepositoryException
-
getProjectSubTasks
public static java.util.List<Task> getProjectSubTasks(java.lang.String reviewProjectName, ResourceResolver resourceResolver) throws FormsNDocumentsException, TaskManagerException
Returns the project sub tasks.- Parameters:
reviewProjectName-resourceResolver-- Returns:
- Throws:
FormsNDocumentsExceptionTaskManagerException
-
getResourceResolver
public static ResourceResolver getResourceResolver(javax.jcr.Session session, ResourceResolverFactory resourceResolverFactory) throws LoginException
Returns the resource resolver for the session.- Parameters:
session-resourceResolverFactory-- Returns:
- ResourceResolver
- Throws:
LoginException
-
getNode
public static javax.jcr.Node getNode(java.lang.String assetPath, ResourceResolver resourceResolver) throws FormsNDocumentsExceptionReturns the node for the given repository path.- Parameters:
assetPath-resourceResolver-- Returns:
- Node
- Throws:
FormsNDocumentsException
-
removeGroup
public static void removeGroup(java.lang.String groupName, ResourceResolver resourceResolver) throws FormsNDocumentsException, javax.jcr.RepositoryExceptionRemoves the user group whose ID is given.- Parameters:
groupName-resourceResolver-- Throws:
FormsNDocumentsExceptionjavax.jcr.RepositoryException
-
createGroup
public static Group createGroup(java.lang.String groupName, java.lang.String relativePath, ResourceResolver resourceResolver) throws FormsNDocumentsException, javax.jcr.RepositoryException
Creates a user group with the name provided.- Parameters:
groupName-resourceResolver-- Returns:
- Throws:
FormsNDocumentsExceptionjavax.jcr.RepositoryException
-
addUserToGroup
public static void addUserToGroup(java.lang.String reviewer, java.lang.String reviewGroupId, ResourceResolver resourceResolver) throws FormsNDocumentsException, javax.jcr.RepositoryExceptionAdds the user as member of group.- Parameters:
reviewer-reviewGroupId-resourceResolver-- Throws:
FormsNDocumentsExceptionjavax.jcr.RepositoryException
-
removeUserFromGroup
public static void removeUserFromGroup(java.lang.String reviewer, java.lang.String reviewGroupId, ResourceResolver resourceResolver) throws FormsNDocumentsException, javax.jcr.RepositoryExceptionRemoves the member from group.- Parameters:
reviewer-reviewGroupId-resourceResolver-- Throws:
FormsNDocumentsExceptionjavax.jcr.RepositoryException
-
createProject
public static Task createProject(java.lang.String reviewName, java.lang.String assetPath, java.lang.String deadline, java.lang.String assignee, ResourceResolver bundleResourceResolver, ResourceResolver resourceResolver) throws FormsNDocumentsException, TaskManagerException
Creates the Task of type Project- Parameters:
reviewName-assetPath-deadline-assignee-bundleResourceResolver-resourceResolver-- Returns:
- Throws:
FormsNDocumentsExceptionTaskManagerException
-
terminateProjectActiveTasks
public static void terminateProjectActiveTasks(java.lang.String reviewProjectName, ResourceResolver resourceResolver) throws FormsNDocumentsException, TaskManagerExceptionCompletes the Project if its Active. Terminates all its incomplete tasks. This method only works for Projects whose status is 'ACTIVE'.- Parameters:
reviewProjectName-resourceResolver-- Throws:
FormsNDocumentsExceptionTaskManagerException
-
updateProjectDeadline
public static void updateProjectDeadline(java.lang.String reviewProjectName, java.lang.String deadline, ResourceResolver resourceResolver) throws FormsNDocumentsException, TaskManagerExceptionUpdates the deadline of Project if its not already completed. Updates the deadline of all its incomplete Tasks.- Parameters:
reviewProjectName-deadline-resourceResolver-- Throws:
FormsNDocumentsExceptionTaskManagerException
-
updateProjectDescription
public static void updateProjectDescription(java.lang.String reviewProjectName, java.lang.String description, ResourceResolver resourceResolver) throws TaskManagerExceptionUpdates the description of Project if its not already completed. Updates the deadline of all its incomplete Tasks.- Parameters:
reviewProjectName-description-resourceResolver-- Throws:
TaskManagerException
-
createTask
public static Task createTask(java.lang.String reviewProjectName, java.lang.String reviewName, java.lang.String deadline, java.lang.String reviewer, java.lang.String assetPath, java.lang.String reviewDescription, ResourceResolver bundleResourceResolver, ResourceResolver resourceResolver) throws FormsNDocumentsException, TaskManagerException
Creates a Task with given attribute- Parameters:
reviewProjectName-reviewName-deadline-reviewer-assetPath-reviewDescription-bundleResourceResolver-resourceResolver-- Returns:
- Throws:
FormsNDocumentsExceptionTaskManagerException
-
isInArray
public static boolean isInArray(java.lang.String searchId, java.lang.String[] idArray)Checks whether the given id is in the given array.- Parameters:
searchId-idArray-- Returns:
- boolean
-
checkCreateReviewArguments
public static void checkCreateReviewArguments(java.lang.String reviewName, java.lang.String[] reviewerList, java.lang.String deadline, ResourceResolver resourceResolver) throws FormsNDocumentsExceptionChecks whether the arguments passed for review creation are valid or not. If not, it throws a FormsNDocumentsException exception.- Parameters:
reviewName-reviewerList-deadline-resourceResolver-- Throws:
FormsNDocumentsException
-
checkUpdateReviewArguments
public static void checkUpdateReviewArguments(java.lang.String[] reviewerList, java.lang.String deadline, ResourceResolver bundleResourceResolver) throws FormsNDocumentsExceptionChecks whether the arguments passed for review updation are valid or not. If not, it throws a FormsNDocumentsException exception.- Parameters:
reviewerList-deadline-bundleResourceResolver- fnd-service system user resource resolver- Throws:
FormsNDocumentsException
-
checkReviewDeadlineArgument
public static void checkReviewDeadlineArgument(java.lang.String deadline) throws FormsNDocumentsExceptionChecks whether the deadline argument passed for review updation is valid or not. If not, it throws a FormsNDocumentsException exception.- Parameters:
deadline-- Throws:
FormsNDocumentsException
-
checkAssetPathArgument
public static void checkAssetPathArgument(java.lang.String assetPath) throws FormsNDocumentsExceptionChecks whether the asset path passed as argument is valid or not. If not, it throws a FormsNDocumentsException exception.- Parameters:
assetPath-- Throws:
FormsNDocumentsException
-
checkNodeExistance
public static javax.jcr.Node checkNodeExistance(java.lang.String assetPath, ResourceResolver resourceResolver) throws FormsNDocumentsExceptionChecks whether the node exist on asset path passed as argument or not. If not, it throws a FormsNDocumentsException exception.- Parameters:
assetPath-resourceResolver-- Returns:
- Node
- Throws:
FormsNDocumentsException
-
-