use of com.evolveum.midpoint.wf.impl.processes.modifyAssignment.AssignmentModification in project midpoint by Evolveum.
the class RoleAssignmentHelper method createApprovalRequestForModification.
ApprovalRequest<AssignmentModification> createApprovalRequestForModification(PcpAspectConfigurationType config, AssignmentType assignmentType, AbstractRoleType role, List<ItemDeltaType> modifications, RelationResolver relationResolver, ReferenceResolver referenceResolver) {
AssignmentModification itemToApprove = new AssignmentModification(assignmentType, role, modifications);
ApprovalRequest<AssignmentModification> request = new ApprovalRequestImpl<>(itemToApprove, config, role.getApprovalSchema(), role.getApproverRef(), role.getApproverExpression(), role.getAutomaticallyApproved(), prismContext);
approvalSchemaHelper.prepareSchema(request.getApprovalSchemaType(), relationResolver, referenceResolver);
return request;
}
use of com.evolveum.midpoint.wf.impl.processes.modifyAssignment.AssignmentModification in project midpoint by Evolveum.
the class ModifyAssignmentAspect method prepareJobCreateInstructions.
private List<PcpChildWfTaskCreationInstruction> prepareJobCreateInstructions(ModelContext<?> modelContext, Task taskFromModel, OperationResult result, List<ApprovalRequest<AssignmentModification>> approvalRequestList) throws SchemaException {
List<PcpChildWfTaskCreationInstruction> instructions = new ArrayList<>();
String focusName = MiscDataUtil.getFocusObjectName(modelContext);
for (ApprovalRequest<AssignmentModification> approvalRequest : approvalRequestList) {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Approval request = {}", approvalRequest);
}
AssignmentModification itemToApprove = approvalRequest.getItemToApprove();
T target = (T) itemToApprove.getTarget();
Validate.notNull(target);
String targetName = getTargetDisplayName(target);
String focusOid = MiscDataUtil.getFocusObjectOid(modelContext);
PrismObject<UserType> requester = baseModelInvocationProcessingHelper.getRequester(taskFromModel, result);
String approvalTaskName = "Approve modifying assignment of " + targetName + " to " + focusName;
// create a JobCreateInstruction for a given change processor (primaryChangeProcessor in this case)
PcpChildWfTaskCreationInstruction instruction = PcpChildWfTaskCreationInstruction.createItemApprovalInstruction(getChangeProcessor(), approvalTaskName, approvalRequest.getApprovalSchemaType(), null);
// set some common task/process attributes
instruction.prepareCommonAttributes(this, modelContext, requester);
// prepare and set the delta that has to be approved
ObjectDelta<? extends ObjectType> delta = requestToDelta(modelContext, approvalRequest, focusOid);
instruction.setDeltasToProcess(delta);
instruction.setObjectRef(modelContext, result);
instruction.setTargetRef(ObjectTypeUtil.createObjectRef(target), result);
// set the names of midPoint task and activiti process instance
String andExecuting = instruction.isExecuteApprovedChangeImmediately() ? "and execution " : "";
instruction.setTaskName("Approval " + andExecuting + " of modifying assignment of " + targetName + " to " + focusName);
instruction.setProcessInstanceName("Modifying assignment of " + targetName + " to " + focusName);
// setup general item approval process
itemApprovalProcessInterface.prepareStartInstruction(instruction);
instructions.add(instruction);
}
return instructions;
}
use of com.evolveum.midpoint.wf.impl.processes.modifyAssignment.AssignmentModification in project midpoint by Evolveum.
the class ResourceAssignmentHelper method createApprovalRequestForModification.
ApprovalRequest<AssignmentModification> createApprovalRequestForModification(PcpAspectConfigurationType config, AssignmentType assignmentType, ResourceType resourceType, List<ItemDeltaType> modifications, RelationResolver relationResolver, ReferenceResolver referenceResolver) {
AssignmentModification itemToApprove = new AssignmentModification(assignmentType, resourceType, modifications);
ApprovalRequest<AssignmentModification> request = new ApprovalRequestImpl<>(itemToApprove, config, null, resourceType.getBusiness().getApproverRef(), Collections.emptyList(), null, prismContext);
approvalSchemaHelper.prepareSchema(request.getApprovalSchemaType(), relationResolver, referenceResolver);
return request;
}
Aggregations