use of org.jbpm.casemgmt.api.model.instance.CaseRoleInstance in project jbpm by kiegroup.
the class CaseFileInstanceImpl method assign.
@Override
public void assign(String roleName, OrganizationalEntity entity) {
if (AuthorizationManager.OWNER_ROLE.equals(roleName) && entity instanceof User) {
assignOwner((User) entity);
return;
}
CaseRoleInstance caseRoleInstance = this.roles.get(roleName);
if (caseRoleInstance == null) {
throw new IllegalArgumentException("No role with name " + roleName + " was found");
}
((CaseRoleInstanceImpl) caseRoleInstance).addRoleAssignment(entity);
}
use of org.jbpm.casemgmt.api.model.instance.CaseRoleInstance in project jbpm by kiegroup.
the class CaseFileInstanceMarshallingStrategy method unmarshal.
@SuppressWarnings("unchecked")
@Override
public Object unmarshal(Context context, ObjectInputStream is, byte[] object, ClassLoader classloader) throws IOException, ClassNotFoundException {
logger.debug("About to read {} bytes to unmarshal CaseFileInstance", (object == null ? 0 : object.length));
Map<String, Object> caseFileContent = (Map<String, Object>) caseFileMarshaller.unmarshal(context, is, object, classloader);
CaseFileInstanceImpl caseFileInstance = new CaseFileInstanceImpl();
caseFileInstance.setCaseId((String) caseFileContent.get(CASE_ID_KEY));
caseFileInstance.setDefinitionId((String) caseFileContent.get(CASE_DEF_ID_KEY));
caseFileInstance.setCaseStartDate((Date) caseFileContent.get(CASE_START_KEY));
caseFileInstance.setCaseEndDate((Date) caseFileContent.get(CASE_END_KEY));
caseFileInstance.setCaseReopenDate((Date) caseFileContent.get(CASE_REOPEN_KEY));
caseFileInstance.setRolesAssignments((Map<String, CaseRoleInstance>) caseFileContent.get(CASE_ROLE_ASSIGNMENTS_KEY));
caseFileInstance.setComments((List<CommentInstance>) caseFileContent.get(CASE_COMMENTS_KEY));
logger.debug("CaseFileInstance meta data unmarshalled properly into {}", caseFileInstance);
List<SerializedContent> caseDataContent = (List<SerializedContent>) caseFileContent.get(CASE_DATA_KEY);
logger.debug("About to read serialized content {}", caseDataContent);
for (SerializedContent serializedContent : caseDataContent) {
ObjectMarshallingStrategy marshaller = marshallersByName.get(serializedContent.getMarshaller());
logger.debug("Marshaller for {} is of type {}", serializedContent, marshaller);
Object value = marshaller.unmarshal(context, is, serializedContent.getContent(), classloader);
caseFileInstance.add(serializedContent.getName(), value);
logger.debug("Data unmarshalled into {} and put into case file under '{}' name", value, serializedContent.getName());
}
caseFileInstance.setAccessRestrictions((Map<String, List<String>>) caseFileContent.get(CASE_DATA_RESTRICTIONS_KEY));
caseFileInstance.setParentInstanceId((Long) caseFileContent.get(CASE_PARENT_INSTANCE_ID_KEY));
caseFileInstance.setParentWorkItemId((Long) caseFileContent.get(CASE_PARENT_WORK_ITEM_ID_KEY));
logger.debug("Unmarshal of CaseFileInstance completed - result {}", caseFileInstance);
return caseFileInstance;
}
Aggregations