当前位置: 首页>>代码示例>>Java>>正文


Java KualiMaintenanceForm.setDerivedValuesOnForm方法代码示例

本文整理汇总了Java中org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm.setDerivedValuesOnForm方法的典型用法代码示例。如果您正苦于以下问题:Java KualiMaintenanceForm.setDerivedValuesOnForm方法的具体用法?Java KualiMaintenanceForm.setDerivedValuesOnForm怎么用?Java KualiMaintenanceForm.setDerivedValuesOnForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm的用法示例。


在下文中一共展示了KualiMaintenanceForm.setDerivedValuesOnForm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: refresh

import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm; //导入方法依赖的package包/类
/**
 * Called on return from a lookup.
 */
@Override
public ActionForward refresh(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
	KualiMaintenanceForm maintenanceForm = (KualiMaintenanceForm) form;

	WebUtils.reuseErrorMapFromPreviousRequest(maintenanceForm);
	maintenanceForm.setDerivedValuesOnForm(request);

	refreshAdHocRoutingWorkgroupLookups(request, maintenanceForm);
	MaintenanceDocument document = (MaintenanceDocument) maintenanceForm.getDocument();

	// call refresh on new maintainable
	Map<String, String> requestParams = new HashMap<String, String>();
	for (Enumeration i = request.getParameterNames(); i.hasMoreElements();) {
		String requestKey = (String) i.nextElement();
		String requestValue = request.getParameter(requestKey);
		requestParams.put(requestKey, requestValue);
	}

	// Add multiple values from Lookup
	Collection<PersistableBusinessObject> rawValues = null;
	if (StringUtils.equals(KRADConstants.MULTIPLE_VALUE, maintenanceForm.getRefreshCaller())) {
		String lookupResultsSequenceNumber = maintenanceForm.getLookupResultsSequenceNumber();
		if (StringUtils.isNotBlank(lookupResultsSequenceNumber)) {
			// actually returning from a multiple value lookup
			String lookupResultsBOClassName = maintenanceForm.getLookupResultsBOClassName();
			Class lookupResultsBOClass = Class.forName(lookupResultsBOClassName);

			rawValues = getLookupResultsService().retrieveSelectedResultBOs(lookupResultsSequenceNumber, lookupResultsBOClass, GlobalVariables.getUserSession().getPerson().getPrincipalId());
		}
	}

	if (rawValues != null) { // KULCOA-1073 - caused by this block running unnecessarily?
		// we need to run the business rules on all the newly added items to the collection
		// KULCOA-1000, KULCOA-1004 removed business rule validation on multiple value return
		// (this was running before the objects were added anyway)
		// getKualiRuleService().applyRules(new SaveDocumentEvent(document));
		String collectionName = maintenanceForm.getLookedUpCollectionName();
		//TODO: Cathy remember to delete this block of comments after I've tested.            
		//            PersistableBusinessObject bo = document.getNewMaintainableObject().getBusinessObject();
		//            Collection maintCollection = this.extractCollection(bo, collectionName);
		//            String docTypeName = ((MaintenanceDocument) maintenanceForm.getDocument()).getDocumentHeader().getWorkflowDocument().getDocumentType();
		//            Class collectionClass = extractCollectionClass(docTypeName, collectionName);
		//
		//            List<MaintainableSectionDefinition> sections = maintenanceDocumentDictionaryService.getMaintainableSections(docTypeName);
		//            Map<String, String> template = MaintenanceUtils.generateMultipleValueLookupBOTemplate(sections, collectionName);
		//            for (PersistableBusinessObject nextBo : rawValues) {
		//                PersistableBusinessObject templatedBo = (PersistableBusinessObject) ObjectUtils.createHybridBusinessObject(collectionClass, nextBo, template);
		//                templatedBo.setNewCollectionRecord(true);
		//                maintCollection.add(templatedBo);
		//            }
		document.getNewMaintainableObject().addMultipleValueLookupResults(document, collectionName, rawValues, false, document.getNewMaintainableObject().getBusinessObject());
		if (LOG.isInfoEnabled()) {
			LOG.info("********************doing editing 3 in refersh()***********************.");
		}
		boolean isEdit = KRADConstants.MAINTENANCE_EDIT_ACTION.equals(maintenanceForm.getMaintenanceAction());
		boolean isCopy = KRADConstants.MAINTENANCE_COPY_ACTION.equals(maintenanceForm.getMaintenanceAction());

		if (isEdit || isCopy) {
			document.getOldMaintainableObject().addMultipleValueLookupResults(document, collectionName, rawValues, true, document.getOldMaintainableObject().getBusinessObject());
			document.getOldMaintainableObject().refresh(maintenanceForm.getRefreshCaller(), requestParams, document);
		}
	}

	document.getNewMaintainableObject().refresh(maintenanceForm.getRefreshCaller(), requestParams, document);

	//pass out customAction from methodToCall parameter. Call processAfterPost
	String fullParameter = (String) request.getAttribute(KRADConstants.METHOD_TO_CALL_ATTRIBUTE);
	if(StringUtils.contains(fullParameter, KRADConstants.CUSTOM_ACTION)){
		String customAction = StringUtils.substringBetween(fullParameter, KRADConstants.METHOD_TO_CALL_PARM1_LEFT_DEL, KRADConstants.METHOD_TO_CALL_PARM1_RIGHT_DEL);
		String[] actionValue = new String[1];
		actionValue[0]= StringUtils.substringAfter(customAction, ".");
		Map<String,String[]> paramMap = new HashMap<String,String[]>(request.getParameterMap());
		paramMap.put(KRADConstants.CUSTOM_ACTION, actionValue);
		doProcessingAfterPost( (KualiMaintenanceForm) form, paramMap );
	}

	return mapping.findForward(RiceConstants.MAPPING_BASIC);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:82,代码来源:KualiMaintenanceDocumentAction.java


注:本文中的org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm.setDerivedValuesOnForm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。