You can get required details like below
//Get session
Session session = workflowSession.getSession();
// Get the Workflow data (the data that is being passed through for this work item)
final WorkflowData workflowData = workItem.getWorkflowData();
// Get the path to the JCR resource from the payload
final String payloadPath = workflowData.getPayload().toString();
ResourceResolver resourceResolver = null;
try {
// Get the ResourceResolver from workflow session
resourceResolver = getResourceResolver(workflowSession.getSession());
Resource resource = resourceResolver.getResource(payloadPath);
// Using resource, we can read/update/add properties to required node by adapting to node or iterating to the required node and save the node by using session
}catch(Exception e){
// Add appropriate logger statements for checking errors
}
Hope this helps!