partyType = v1.getRelatedOne("PartyType");
Map<String, Object> fields2 = UtilMisc.toMap("partyTypeId", (Object) "PARTY_GROUP");
groupType = getDelegator().findByPrimaryKeyCache("PartyType", fields2);
} catch (GenericEntityException e) {
throw new WfException(e.getMessage(), e);
}
if (EntityTypeUtil.isType(partyType, groupType)) {
// party is a group
List<GenericValue> partyRelations = null;
try {
Map<String, Object> fields = UtilMisc.toMap("partyIdFrom", (Object) performer.getString("partyId"),
"partyRelationshipTypeId", "GROUP_ROLLUP");
partyRelations = getDelegator().findByAnd("PartyRelationship", fields);
} catch (GenericEntityException e) {
throw new WfException(e.getMessage(), e);
}
// make assignments for these parties
Debug.logVerbose("[WfActivity.createAssignments] : Group assignment", module);
for (GenericValue value : partyRelations) {
assign(
WfFactory.getWfResource(getDelegator(), null, null, value.getString("partyIdTo"), null),
true);
}
} else {
// not a group
Debug.logVerbose("[WfActivity.createAssignments] : (G) Single assignment", module);
assign(WfFactory.getWfResource(performer), false);
}
}
// check for role types
else if (performer.get("roleTypeId") != null && !performer.getString("roleTypeId").equals("_NA_")) {
List<GenericValue> partyRoles = null;
try {
Map<String, Object> fields = UtilMisc.toMap("roleTypeId", (Object) performer.getString("roleTypeId"));
partyRoles = getDelegator().findByAnd("PartyRole", fields);
} catch (GenericEntityException e) {
throw new WfException(e.getMessage(), e);
}
// loop through the roles and create assignments
Debug.logVerbose("[WfActivity.createAssignments] : Role assignment", module);
for (GenericValue value : partyRoles) {