本文整理汇总了Java中org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm类的典型用法代码示例。如果您正苦于以下问题:Java KualiMaintenanceForm类的具体用法?Java KualiMaintenanceForm怎么用?Java KualiMaintenanceForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KualiMaintenanceForm类属于org.kuali.rice.kns.web.struts.form包,在下文中一共展示了KualiMaintenanceForm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toggleInactiveRecordDisplay
import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm; //导入依赖的package包/类
/**
* Turns on (or off) the inactive record display for a maintenance collection.
*/
public ActionForward toggleInactiveRecordDisplay(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
KualiMaintenanceForm maintenanceForm = (KualiMaintenanceForm) form;
MaintenanceDocument document = (MaintenanceDocument) maintenanceForm.getDocument();
Maintainable oldMaintainable = document.getOldMaintainableObject();
Maintainable newMaintainable = document.getNewMaintainableObject();
String collectionName = extractCollectionName(request, KRADConstants.TOGGLE_INACTIVE_METHOD);
if (collectionName == null) {
LOG.error("Unable to get find collection name in request.");
throw new RuntimeException("Unable to get find collection class in request.");
}
String parameterName = (String) request.getAttribute(KRADConstants.METHOD_TO_CALL_ATTRIBUTE);
boolean showInactive = Boolean.parseBoolean(StringUtils.substringBetween(parameterName, KRADConstants.METHOD_TO_CALL_BOPARM_LEFT_DEL, "."));
oldMaintainable.setShowInactiveRecords(collectionName, showInactive);
newMaintainable.setShowInactiveRecords(collectionName, showInactive);
return mapping.findForward(RiceConstants.MAPPING_BASIC);
}
示例2: isDocumentSession
import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm; //导入依赖的package包/类
public static boolean isDocumentSession(Document document, PojoFormBase docForm) {
boolean sessionDoc = document instanceof org.kuali.rice.krad.document.SessionDocument;
boolean dataDictionarySessionDoc = false;
if (!sessionDoc) {
DataDictionary dataDictionary = KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary();
if (docForm instanceof KualiMaintenanceForm) {
KualiMaintenanceForm maintenanceForm = (KualiMaintenanceForm) docForm;
if (dataDictionary != null) {
if (maintenanceForm.getDocTypeName() != null) {
MaintenanceDocumentEntry maintenanceDocumentEntry = (MaintenanceDocumentEntry) dataDictionary.getDocumentEntry(maintenanceForm.getDocTypeName());
dataDictionarySessionDoc = maintenanceDocumentEntry.isSessionDocument();
}
}
}
else {
if (document != null && dataDictionary != null) {
KNSDocumentEntry documentEntry = (KNSDocumentEntry) dataDictionary.getDocumentEntry(document.getClass().getName());
dataDictionarySessionDoc = documentEntry.isSessionDocument();
}
}
}
return sessionDoc || dataDictionarySessionDoc;
}
示例3: createNewKualiMaintenanceForm
import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm; //导入依赖的package包/类
/**
* Creates a KualiMaintenanceForm with the given rule template inside of its RuleBaseValues instance.
*
* @param rtName The rule template to use.
*/
private void createNewKualiMaintenanceForm(String rtName) {
// Initialize the required variables.
final KualiMaintenanceForm kmForm = new KualiMaintenanceForm();
final MaintenanceDocument maintDoc = new MaintenanceDocumentBase();
final Maintainable oldMaint = new RoutingRuleMaintainable();
final Maintainable newMaint = new RoutingRuleMaintainable();
final RuleBaseValues rbValues = new RuleBaseValues();
// Setup the rule base and the maintainables.
rbValues.setRuleTemplate(KEWServiceLocator.getRuleTemplateService().findByRuleTemplateName(rtName));
oldMaint.setBusinessObject(rbValues);
oldMaint.setBoClass(rbValues.getClass());
newMaint.setBusinessObject(rbValues);
newMaint.setBoClass(rbValues.getClass());
// Setup the maintenance document and the maintenance form.
maintDoc.setOldMaintainableObject(oldMaint);
maintDoc.setNewMaintainableObject(newMaint);
kmForm.setDocument(maintDoc);
KNSGlobalVariables.setKualiForm(kmForm);
}
示例4: setDerivedValues
import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm; //导入依赖的package包/类
public void setDerivedValues(KualiForm form, HttpServletRequest request){
KualiMaintenanceForm maintenanceForm = (KualiMaintenanceForm) form;
MaintenanceDocumentBase maintenanceDocument = (MaintenanceDocumentBase) maintenanceForm.getDocument();
Organization newOrg = (Organization) maintenanceDocument.getNewMaintainableObject().getBusinessObject();
String organizationZipCode = newOrg.getOrganizationZipCode();
String organizationCountryCode = newOrg.getOrganizationCountryCode();
if (StringUtils.isNotBlank(organizationZipCode) && StringUtils.isNotBlank(organizationCountryCode)) {
PostalCode postalZipCode = SpringContext.getBean(PostalCodeService.class).getPostalCode(organizationCountryCode, organizationZipCode);
if (ObjectUtils.isNotNull(postalZipCode)) {
newOrg.setOrganizationCityName(postalZipCode.getCityName());
newOrg.setOrganizationStateCode(postalZipCode.getStateCode());
}
else {
newOrg.setOrganizationCityName(KRADConstants.EMPTY_STRING);
newOrg.setOrganizationStateCode(KRADConstants.EMPTY_STRING);
}
}
else {
newOrg.setOrganizationCityName(KRADConstants.EMPTY_STRING);
newOrg.setOrganizationStateCode(KRADConstants.EMPTY_STRING);
}
}
示例5: getKeyValues
import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm; //导入依赖的package包/类
@Override
public List<KeyValue> getKeyValues() {
List<KeyValue> roleNames = new ArrayList<KeyValue>();
if (KNSGlobalVariables.getKualiForm() != null && KNSGlobalVariables.getKualiForm() instanceof KualiMaintenanceForm) {
KualiMaintenanceForm form = (KualiMaintenanceForm)KNSGlobalVariables.getKualiForm();
MaintenanceDocument document = (MaintenanceDocument)form.getDocument();
PersistableBusinessObject businessObject = document.getNewMaintainableObject().getBusinessObject();
RuleBaseValues rule = null;
if (businessObject instanceof RuleBaseValues) {
rule = (RuleBaseValues)businessObject;
} else if (businessObject instanceof RuleDelegationBo) {
rule = ((RuleDelegationBo)businessObject).getDelegationRule();
} else {
throw new RiceRuntimeException("Cannot locate RuleBaseValues business object on maintenance document. Business Object was " + businessObject);
}
RuleTemplateBo ruleTemplate = rule.getRuleTemplate();
List<RoleName> roles = ruleTemplate.getRoles();
for (RoleName role : roles) {
roleNames.add(new ConcreteKeyValue(role.getName(), role.getLabel()));
}
}
return roleNames;
}
示例6: createNewKualiMaintenanceForm
import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm; //导入依赖的package包/类
/**
* Creates a KualiMaintenanceForm with the given rule template inside of its RuleBaseValues instance.
*
* @param rtName The rule template to use.
*/
private void createNewKualiMaintenanceForm(String rtName) {
// Initialize the required variables.
final KualiMaintenanceForm kmForm = new KualiMaintenanceForm();
final MaintenanceDocument maintDoc = new MaintenanceDocumentBase();
final Maintainable oldMaint = new RoutingRuleMaintainable();
final Maintainable newMaint = new RoutingRuleMaintainable();
final RuleBaseValues rbValues = new RuleBaseValues();
// Setup the rule base and the maintainables.
rbValues.setRuleTemplate(KEWServiceLocator.getRuleTemplateService().findByRuleTemplateName(rtName));
oldMaint.setBusinessObject(rbValues);
oldMaint.setBoClass(rbValues.getClass());
newMaint.setBusinessObject(rbValues);
newMaint.setBoClass(rbValues.getClass());
// Setup the maintenance document and the maintenance form.
maintDoc.setOldMaintainableObject(oldMaint);
maintDoc.setNewMaintainableObject(newMaint);
maintDoc.getDocumentHeader().setDocumentDescription("This is a rule template test");
kmForm.setDocument(maintDoc);
KNSGlobalVariables.setKualiForm(kmForm);
}
示例7: isFormRepresentingLockObject
import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm; //导入依赖的package包/类
protected boolean isFormRepresentingLockObject(KualiDocumentFormBase form) throws Exception {
if (form instanceof KualiMaintenanceForm) {
KualiMaintenanceForm maintForm = (KualiMaintenanceForm) form;
if (ObjectUtils.isNotNull(maintForm.getBusinessObjectClassName())) {
return PessimisticLock.class.isAssignableFrom(Class.forName(((KualiMaintenanceForm) form).getBusinessObjectClassName()));
}
}
return false;
}
示例8: docHandler
import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm; //导入依赖的package包/类
/**
* Handles creating and loading of documents.
*/
@Override
public ActionForward docHandler(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionForward af = super.docHandler(mapping, form, request, response);
if (af.getName().equals(KRADConstants.KRAD_INITIATED_DOCUMENT_VIEW_NAME))
{
return af;
}
KualiMaintenanceForm kualiMaintenanceForm = (KualiMaintenanceForm) form;
if (KewApiConstants.ACTIONLIST_COMMAND.equals(kualiMaintenanceForm.getCommand()) || KewApiConstants.DOCSEARCH_COMMAND.equals(kualiMaintenanceForm.getCommand()) || KewApiConstants.SUPERUSER_COMMAND.equals(kualiMaintenanceForm.getCommand()) || KewApiConstants.HELPDESK_ACTIONLIST_COMMAND.equals(kualiMaintenanceForm.getCommand()) && kualiMaintenanceForm.getDocId() != null) {
if (kualiMaintenanceForm.getDocument() instanceof MaintenanceDocument) {
kualiMaintenanceForm.setReadOnly(true);
kualiMaintenanceForm.setMaintenanceAction(((MaintenanceDocument) kualiMaintenanceForm.getDocument()).getNewMaintainableObject().getMaintenanceAction());
//Retrieving the FileName from BO table
Maintainable tmpMaintainable = ((MaintenanceDocument) kualiMaintenanceForm.getDocument()).getNewMaintainableObject();
if(tmpMaintainable.getBusinessObject() instanceof PersistableAttachment) {
PersistableAttachment bo = (PersistableAttachment) getBusinessObjectService().retrieve(tmpMaintainable.getBusinessObject());
if (bo != null) {
request.setAttribute("fileName", bo.getFileName());
}
}
}
else {
LOG.error("Illegal State: document is not a maintenance document");
throw new IllegalArgumentException("Document is not a maintenance document");
}
}
else if (KewApiConstants.INITIATE_COMMAND.equals(kualiMaintenanceForm.getCommand())) {
kualiMaintenanceForm.setReadOnly(false);
return setupMaintenance(mapping, form, request, response, KRADConstants.MAINTENANCE_NEW_ACTION);
}
else {
LOG.error("We should never have gotten to here");
throw new IllegalArgumentException("docHandler called with invalid parameters");
}
return mapping.findForward(RiceConstants.MAPPING_BASIC);
}
示例9: doProcessingAfterPost
import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm; //导入依赖的package包/类
/**
* This method does all special processing on a document that should happen on each HTTP post (ie, save, route, approve, etc).
*
* @param form
*/
@SuppressWarnings("unchecked")
protected void doProcessingAfterPost( KualiForm form, HttpServletRequest request ) {
MaintenanceDocument document = (MaintenanceDocument) ((KualiMaintenanceForm)form).getDocument();
Maintainable maintainable = document.getNewMaintainableObject();
Object bo = maintainable.getBusinessObject();
getBusinessObjectService().linkUserFields(bo);
maintainable.processAfterPost(document, request.getParameterMap() );
}
示例10: populateAuthorizationFields
import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm; //导入依赖的package包/类
protected void populateAuthorizationFields(KualiDocumentFormBase formBase){
super.populateAuthorizationFields(formBase);
KualiMaintenanceForm maintenanceForm = (KualiMaintenanceForm) formBase;
MaintenanceDocument maintenanceDocument = (MaintenanceDocument) maintenanceForm.getDocument();
MaintenanceDocumentAuthorizer maintenanceDocumentAuthorizer = (MaintenanceDocumentAuthorizer) getDocumentHelperService().getDocumentAuthorizer(maintenanceDocument);
Person user = GlobalVariables.getUserSession().getPerson();
maintenanceForm.setReadOnly(!formBase.getDocumentActions().containsKey(KRADConstants.KUALI_ACTION_CAN_EDIT));
MaintenanceDocumentRestrictions maintenanceDocumentAuthorizations = getBusinessObjectAuthorizationService().getMaintenanceDocumentRestrictions(maintenanceDocument, user);
maintenanceForm.setAuthorizations(maintenanceDocumentAuthorizations);
}
示例11: getKeyValues
import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm; //导入依赖的package包/类
/**
* @see org.kuali.rice.krad.keyvalues.KeyValuesFinder#getKeyValues()
*/
@Override
public List<KeyValue> getKeyValues() {
final List<KeyValue> actionRequestCodes = new ArrayList<KeyValue>();
// Acquire the Kuali form, and return the super class' result if the form is not a Kuali maintenance form.
final KualiForm kForm = KNSGlobalVariables.getKualiForm();
if (!(kForm instanceof KualiMaintenanceForm)) {
return super.getKeyValues();
}
// Acquire the Kuali maintenance form's document and its rule template.
final MaintenanceDocument maintDoc = (MaintenanceDocument) ((KualiMaintenanceForm) kForm).getDocument();
final RuleTemplateBo ruleTemplate = ((RuleBaseValues) maintDoc.getNewMaintainableObject().getBusinessObject()).getRuleTemplate();
// Ensure that the rule template is defined.
if (ruleTemplate == null) {
throw new RuntimeException("Rule template cannot be null for document ID " + maintDoc.getDocumentNumber());
}
// get the options to check for, as well as their related KEW constants.
final RuleTemplateOptionBo[] ruleOpts = {ruleTemplate.getAcknowledge(), ruleTemplate.getComplete(),
ruleTemplate.getApprove(), ruleTemplate.getFyi()};
final String[] ruleConsts = {KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ, KewApiConstants.ACTION_REQUEST_COMPLETE_REQ,
KewApiConstants.ACTION_REQUEST_APPROVE_REQ, KewApiConstants.ACTION_REQUEST_FYI_REQ};
// Add the rule options to the list if they are not defined (true by default) or if they are explicitly set to true.
for (int i = 0; i < ruleOpts.length; i++) {
if (ruleOpts[i] == null || ruleOpts[i].getValue() == null || "true".equals(ruleOpts[i].getValue())) {
actionRequestCodes.add(new ConcreteKeyValue(ruleConsts[i], KewApiConstants.ACTION_REQUEST_CODES.get(ruleConsts[i])));
}
}
return actionRequestCodes;
}
示例12: assertRuleTemplateHasExpectedDefaultActions
import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm; //导入依赖的package包/类
/**
* A convenience method for verifying that a rule template contains the expected default action.
*
* @param expectedDefActions The default actions expected by each responsibility (person, then group, then role).
* @throws Exception
*/
private void assertRuleTemplateHasExpectedDefaultActions(String[] expectedDefActions) throws Exception {
// Acquire the Maintainable and the responsibility constants.
final RoutingRuleMaintainable rrMaint = (RoutingRuleMaintainable) ((MaintenanceDocument) ((KualiMaintenanceForm)
KNSGlobalVariables.getKualiForm()).getDocument()).getNewMaintainableObject();
final String[] respSectionConsts = { KEWPropertyConstants.PERSON_RESP_SECTION, KEWPropertyConstants.GROUP_RESP_SECTION,
KEWPropertyConstants.ROLE_RESP_SECTION };
// Check each responsibility's default action.
for (int i = 0; i < respSectionConsts.length; i++) {
final String actualDefAction =
((RuleResponsibilityBo) rrMaint.initNewCollectionLine(respSectionConsts[i])).getActionRequestedCd();
assertEquals("The rule template does not have the expected default approve action.", expectedDefActions[i], actualDefAction);
}
}
示例13: getDepartmentForJobNumber
import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm; //导入依赖的package包/类
public ActionForward getDepartmentForJobNumber(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
KualiMaintenanceForm kualiForm = (KualiMaintenanceForm) form;
String principalId = (String) request.getAttribute("principalId");
Long jobNumber = (Long) request.getAttribute("jobNumber");
JobContract job = HrServiceLocator.getJobService().getJob(principalId, jobNumber, LocalDate.now());
kualiForm.setAnnotation(job.getDept());
return mapping.findForward("ws");
}
示例14: doProcessingAfterPost
import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm; //导入依赖的package包/类
/**
* This method does all special processing on a document that should happen on each HTTP post (ie, save, route, approve, etc).
*
* @param form
*/
@SuppressWarnings("unchecked")
protected void doProcessingAfterPost( KualiForm form, HttpServletRequest request ) {
MaintenanceDocument document = (MaintenanceDocument) ((KualiMaintenanceForm)form).getDocument();
Maintainable maintainable = document.getNewMaintainableObject();
PersistableBusinessObject bo = maintainable.getBusinessObject();
getBusinessObjectService().linkUserFields(bo);
maintainable.processAfterPost(document, request.getParameterMap() );
}
示例15: 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);
}