}
protected Form submitAssignmentForm(FormData formData, WorkflowAssignment assignment, PackageActivityForm activityForm) {
Form nextForm = null;
ApplicationContext ac = AppUtil.getApplicationContext();
AppService appService = (AppService) ac.getBean("appService");
FormService formService = (FormService) ac.getBean("formService");
WorkflowManager workflowManager = (WorkflowManager) ac.getBean("workflowManager");
String activityId = assignment.getActivityId();
String processId = assignment.getProcessId();
// get form
Form currentForm = activityForm.getForm();
// submit form
formData = formService.executeFormActions(currentForm, formData);
setProperty("submitted", Boolean.TRUE);
setProperty("redirectUrlAfterComplete", getUrl());
setRedirectUrl(getUrl());
// check for validation errors
if (formData.getFormResult(AssignmentWithdrawButton.DEFAULT_ID) != null) {
// withdraw assignment
workflowManager.assignmentWithdraw(activityId);
} else if (formData.getFormResult(AssignmentCompleteButton.DEFAULT_ID) != null) {
// complete assignment
Map<String, String> variableMap = AppUtil.retrieveVariableDataFromMap(getRequestParameters());
formData = appService.completeAssignmentForm(currentForm, assignment, formData, variableMap);
Map<String, String> errors = formData.getFormErrors();
if (errors.isEmpty() && activityForm.isAutoContinue()) {
// redirect to next activity if available