partyType = v1.getRelatedOne("PartyType");
Map fields2 = UtilMisc.toMap("partyTypeId", "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
Collection partyRelations = null;
try {
Map fields = UtilMisc.toMap("partyIdFrom", 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);
Iterator i = partyRelations.iterator();
while (i.hasNext()) {
GenericValue value = (GenericValue) i.next();
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_")) {
Collection partyRoles = null;
try {
Map fields = UtilMisc.toMap("roleTypeId", 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);
Iterator i = partyRoles.iterator();