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.String
ASSET_PATH
static java.lang.String
PROJECT_SUB_TYPE
static java.lang.String
PROJECT_TYPE
static java.lang.String
REVIEW_CONTAINER_NODE_NAME
static java.lang.String
REVIEW_DEADLINE
static java.lang.String
REVIEW_DESCRIPTION
static java.lang.String
REVIEW_GROUP
static java.lang.String
REVIEW_ID
static java.lang.String
REVIEW_INITIATOR
static java.lang.String
REVIEW_NAME
static java.lang.String
REVIEW_PROJECT_NAME
static java.lang.String
REVIEW_TASKS_PATH
static java.lang.String
REVIEWERS
static java.lang.String
TASK_DUE_DATE
static java.lang.String
UNDER_REVIEW
-
Constructor Summary
Constructors Constructor Description RnCUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addUserToGroup(java.lang.String reviewer, java.lang.String reviewGroupId, ResourceResolver resourceResolver)
Adds the user as member of group.static void
checkAssetPathArgument(java.lang.String assetPath)
Checks whether the asset path passed as argument is valid or not.static void
checkCreateReviewArguments(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.Node
checkNodeExistance(java.lang.String assetPath, ResourceResolver resourceResolver)
Checks whether the node exist on asset path passed as argument or not.static void
checkReviewDeadlineArgument(java.lang.String deadline)
Checks whether the deadline argument passed for review updation is valid or not.static void
checkUpdateReviewArguments(java.lang.String[] reviewerList, java.lang.String deadline, ResourceResolver bundleResourceResolver)
Checks whether the arguments passed for review updation are valid or not.static Group
createGroup(java.lang.String groupName, java.lang.String relativePath, ResourceResolver resourceResolver)
Creates a user group with the name provided.static Task
createProject(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 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)
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.Node
getNode(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 ResourceResolver
getResourceResolver(javax.jcr.Session session, ResourceResolverFactory resourceResolverFactory)
Returns the resource resolver for the session.static boolean
isInArray(java.lang.String searchId, java.lang.String[] idArray)
Checks whether the given id is in the given array.static java.lang.Boolean
isMemberOfGroup(java.lang.String groupId, java.lang.String userId, ResourceResolver resourceResolver)
Checks whether the user is member of group or not.static boolean
isTaskEligibleForUpdate(Status status)
Decides whether the task status passed, makes the task eligible for update or not.static void
removeGroup(java.lang.String groupName, ResourceResolver resourceResolver)
Removes the user group whose ID is given.static void
removeUserFromGroup(java.lang.String reviewer, java.lang.String reviewGroupId, ResourceResolver resourceResolver)
Removes the member from group.static void
terminateProjectActiveTasks(java.lang.String reviewProjectName, ResourceResolver resourceResolver)
Completes the Project if its Active.static void
updateProjectDeadline(java.lang.String reviewProjectName, java.lang.String deadline, ResourceResolver resourceResolver)
Updates the deadline of Project if its not already completed.static void
updateProjectDescription(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.RepositoryException
Checks whether the user is member of group or not.- Parameters:
groupId
-userId
-resourceResolver
-- Returns:
- Throws:
FormsNDocumentsException
javax.jcr.RepositoryException
-
getGroupMembers
public static java.util.List<java.lang.String> getGroupMembers(java.lang.String groupId, ResourceResolver resourceResolver) throws FormsNDocumentsException, javax.jcr.RepositoryException
Returns the members of the specified group.- Parameters:
groupId
-resourceResolver
-- Returns:
- Throws:
FormsNDocumentsException
javax.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:
FormsNDocumentsException
TaskManagerException
-
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 FormsNDocumentsException
Returns 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.RepositoryException
Removes the user group whose ID is given.- Parameters:
groupName
-resourceResolver
-- Throws:
FormsNDocumentsException
javax.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:
FormsNDocumentsException
javax.jcr.RepositoryException
-
addUserToGroup
public static void addUserToGroup(java.lang.String reviewer, java.lang.String reviewGroupId, ResourceResolver resourceResolver) throws FormsNDocumentsException, javax.jcr.RepositoryException
Adds the user as member of group.- Parameters:
reviewer
-reviewGroupId
-resourceResolver
-- Throws:
FormsNDocumentsException
javax.jcr.RepositoryException
-
removeUserFromGroup
public static void removeUserFromGroup(java.lang.String reviewer, java.lang.String reviewGroupId, ResourceResolver resourceResolver) throws FormsNDocumentsException, javax.jcr.RepositoryException
Removes the member from group.- Parameters:
reviewer
-reviewGroupId
-resourceResolver
-- Throws:
FormsNDocumentsException
javax.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:
FormsNDocumentsException
TaskManagerException
-
terminateProjectActiveTasks
public static void terminateProjectActiveTasks(java.lang.String reviewProjectName, ResourceResolver resourceResolver) throws FormsNDocumentsException, TaskManagerException
Completes the Project if its Active. Terminates all its incomplete tasks. This method only works for Projects whose status is 'ACTIVE'.- Parameters:
reviewProjectName
-resourceResolver
-- Throws:
FormsNDocumentsException
TaskManagerException
-
updateProjectDeadline
public static void updateProjectDeadline(java.lang.String reviewProjectName, java.lang.String deadline, ResourceResolver resourceResolver) throws FormsNDocumentsException, TaskManagerException
Updates the deadline of Project if its not already completed. Updates the deadline of all its incomplete Tasks.- Parameters:
reviewProjectName
-deadline
-resourceResolver
-- Throws:
FormsNDocumentsException
TaskManagerException
-
updateProjectDescription
public static void updateProjectDescription(java.lang.String reviewProjectName, java.lang.String description, ResourceResolver resourceResolver) throws TaskManagerException
Updates 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:
FormsNDocumentsException
TaskManagerException
-
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 FormsNDocumentsException
Checks 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 FormsNDocumentsException
Checks 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 FormsNDocumentsException
Checks 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 FormsNDocumentsException
Checks 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 FormsNDocumentsException
Checks 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
-
-