use of edu.cornell.kfs.module.purap.businessobject.LevelOrganization in project cu-kfs by CU-CommunityApps.
the class IWantDocumentAction method execute.
/**
* @see org.kuali.kfs.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping,
* org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse)
*/
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionForward actionForward = super.execute(mapping, form, request, response);
IWantDocumentForm documentForm = (IWantDocumentForm) form;
IWantDocument iWantDoc = documentForm.getIWantDocument();
if (documentForm != null && documentForm.getDocument() != null) {
iWantDoc.setExplanation(iWantDoc.getDocumentHeader().getExplanation());
// populate department drop down
if (!documentForm.getPreviousSelectedOrg().equalsIgnoreCase(((IWantDocument) documentForm.getDocument()).getCollegeLevelOrganization())) {
String cLevelOrg = ((IWantDocument) documentForm.getDocument()).getCollegeLevelOrganization();
documentForm.getDeptOrgKeyLabels().clear();
documentForm.getDeptOrgKeyLabels().add(new ConcreteKeyValue("", "Please Select"));
if (StringUtils.isNotEmpty(cLevelOrg)) {
IWantDocumentService iWantDocumentService = SpringContext.getBean(IWantDocumentService.class);
List<LevelOrganization> dLevelOrgs = iWantDocumentService.getDLevelOrganizations(cLevelOrg);
// Get the list of chart+org combos to forcibly exclude from the drop-down, if any.
String routingChart = ((IWantDocument) documentForm.getDocument()).getRoutingChart();
Collection<String> dLevelExcludesList = getParameterService().getParameterValuesAsString(PurapConstants.PURAP_NAMESPACE, KRADConstants.DetailTypes.DOCUMENT_DETAIL_TYPE, IWANT_DEPT_ORGS_TO_EXCLUDE_PARM);
Set<String> dLevelExcludes = new HashSet<String>((dLevelExcludesList != null) ? dLevelExcludesList : Collections.<String>emptyList());
for (LevelOrganization levelOrganization : dLevelOrgs) {
// Add each department-level org to the drop-down as long as it is not marked for exclusion.
if (!dLevelExcludes.contains(routingChart + "=" + levelOrganization.getCode())) {
documentForm.getDeptOrgKeyLabels().add(new ConcreteKeyValue(levelOrganization.getCode(), levelOrganization.getCodeAndDescription()));
}
}
}
}
setupDocumentMessages(documentForm.getStep());
}
return actionForward;
}
Aggregations