• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GlobalVariables类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.kuali.rice.krad.util.GlobalVariables的典型用法代码示例。如果您正苦于以下问题:Java GlobalVariables类的具体用法?Java GlobalVariables怎么用?Java GlobalVariables使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GlobalVariables类属于org.kuali.rice.krad.util包,在下文中一共展示了GlobalVariables类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: checkAuthorization

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
@Override
protected void checkAuthorization(ActionForm form, String methodToCall) throws AuthorizationException {
    if (!(form instanceof LookupForm)) {
        super.checkAuthorization(form, methodToCall);
    } else {
        try {
            Class businessObjectClass = Class.forName(((LookupForm) form).getBusinessObjectClassName());
            if (!KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(
                    GlobalVariables.getUserSession().getPrincipalId(), KRADConstants.KNS_NAMESPACE,
                    KimConstants.PermissionTemplateNames.LOOK_UP_RECORDS,
                    KRADUtils.getNamespaceAndComponentSimpleName(businessObjectClass),
                    Collections.<String, String>emptyMap())) {
                throw new AuthorizationException(GlobalVariables.getUserSession().getPerson().getPrincipalName(),
                        KimConstants.PermissionTemplateNames.LOOK_UP_RECORDS,
                        businessObjectClass.getSimpleName());
            }
        }
        catch (ClassNotFoundException e) {
            LOG.warn("Unable to load BusinessObject class: " + ((LookupForm) form).getBusinessObjectClassName(), e);
            super.checkAuthorization(form, methodToCall);
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:KualiLookupAction.java


示例2: navigate

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
/**
 * Handles menu navigation between view pages
 */
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=navigate")
public ModelAndView navigate(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
        HttpServletRequest request, HttpServletResponse response) {
    String pageId = form.getActionParamaterValue(UifParameters.NAVIGATE_TO_PAGE_ID);

    if (pageId.equals("UifCompView-Page8")) {
        GlobalVariables.getMessageMap().putError("gField1", "serverTestError");
        GlobalVariables.getMessageMap().putError("gField1", "serverTestError2");
        GlobalVariables.getMessageMap().putError("gField2", "serverTestError");
        GlobalVariables.getMessageMap().putError("gField3", "serverTestError");
        GlobalVariables.getMessageMap().putWarning("gField1", "serverTestWarning");
        GlobalVariables.getMessageMap().putWarning("gField2", "serverTestWarning");
        GlobalVariables.getMessageMap().putInfo("gField2", "serverTestInfo");
        GlobalVariables.getMessageMap().putInfo("gField3", "serverTestInfo");
    }

    return getModelAndView(form, pageId);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:UifComponentsTestController.java


示例3: validateSearchParameters

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
/**
 * Add additional validation to check that numeric values are positive
 *
 * @see LookupableImpl#validateSearchParameters(org.kuali.rice.krad.lookup.LookupForm, java.util.Map)
 */
@Override
protected boolean validateSearchParameters(LookupForm form, Map<String, String> searchCriteria) {
    boolean valid = super.validateSearchParameters(form, searchCriteria);

    if (form.getViewPostMetadata() != null && form.getViewPostMetadata().getLookupCriteria() != null) {
        for (Map.Entry<String, Map<String, Object>> lookupCriteria : form.getViewPostMetadata().getLookupCriteria().entrySet()) {
            String propertyName = lookupCriteria.getKey();

            validateSearchParameterPositiveValues(form, propertyName, searchCriteria.get(propertyName));
        }
    }

    if (GlobalVariables.getMessageMap().hasErrors()) {
        valid = false;
    }

    return valid;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:TravelLookupableImpl.java


示例4: setFilter

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
/**
* Sets the filter.
*
* <p>
* Sets the action list filter in the form.
* </p>
*
* @param form - ActionListForm form
* @param result - Spring form binding result
* @param request - http request
* @param response - http response
* @return start() forwards to start method to refresh action list
*/
@RequestMapping(params = "methodToCall=setFilter")
public ModelAndView setFilter(UifFormBase form){
    ActionListForm actionListForm = (ActionListForm) form;

    //validate the filter through the actionitem/actionlist service (I'm thinking actionlistservice)
    final UserSession uSession = getUserSession();

    ActionListFilter alFilter = actionListForm.getLoadedFilter();
    if (StringUtils.isNotBlank(alFilter.getDelegatorId()) && !KewApiConstants.DELEGATION_DEFAULT.equals(alFilter.getDelegatorId()) &&
            StringUtils.isNotBlank(alFilter.getPrimaryDelegateId()) && !KewApiConstants.PRIMARY_DELEGATION_DEFAULT.equals(alFilter.getPrimaryDelegateId())){
        // If the primary and secondary delegation drop-downs are both visible and are both set to non-default values,
        // then reset the secondary delegation drop-down to its default value.
        alFilter.setDelegatorId(KewApiConstants.DELEGATION_DEFAULT);
    }

    actionListForm.setFilter(alFilter);
    if (GlobalVariables.getMessageMap().hasNoErrors()) {
        actionListForm.setRequeryActionList(true);
        return start(actionListForm);
    }

    return start(actionListForm);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:37,代码来源:ActionListController.java


示例5: lockCanBeIgnored

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
/**
 * Guesses whether the current user should be allowed to change a document even though it is locked. It
 * probably should use Authorization instead? See KULNRVSYS-948
 *
 * @param lockedDocument
 * @return true if the document lock can be ignored
 *
 */
private static boolean lockCanBeIgnored(WorkflowDocument lockedDocument) {
    // TODO: implement real authorization for Maintenance Document Save/Route - KULNRVSYS-948
    if (lockedDocument == null) {
        return true;
    }

    // get the user-id. if no user-id, then we can do this test, so exit
    String userId = GlobalVariables.getUserSession().getPrincipalId().trim();
    if (StringUtils.isBlank(userId)) {
        return false; // dont bypass locking
    }

    // if the current user is not the initiator of the blocking document
    if (!userId.equalsIgnoreCase(lockedDocument.getInitiatorPrincipalId().trim())) {
        return false;
    }

    // if the blocking document hasn't been routed, we can ignore it
    return lockedDocument.isInitiated();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:MaintenanceUtils.java


示例6: checkAuthorization

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
@Override
protected void checkAuthorization(ActionForm form, String methodToCall) throws AuthorizationException {
    if (!(form instanceof InquiryForm)) {
        super.checkAuthorization(form, methodToCall);
    } else {
        try {
        	if(!KRADConstants.DOWNLOAD_BO_ATTACHMENT_METHOD.equals(methodToCall)){
        		Class businessObjectClass = Class.forName(((InquiryForm) form).getBusinessObjectClassName());
        		if (!KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(
                        GlobalVariables.getUserSession().getPrincipalId(), KRADConstants.KNS_NAMESPACE,
                        KimConstants.PermissionTemplateNames.INQUIRE_INTO_RECORDS,
                        KRADUtils.getNamespaceAndComponentSimpleName(businessObjectClass),
                        Collections.<String, String>emptyMap())) {

        			throw new AuthorizationException(GlobalVariables.getUserSession().getPerson().getPrincipalName(), 
                		"inquire",
                		businessObjectClass.getSimpleName());
        		}
        	}
        }
        catch (ClassNotFoundException e) {
        	LOG.warn("Unable to load BusinessObject class: " + ((InquiryForm) form).getBusinessObjectClassName(), e);
            super.checkAuthorization(form, methodToCall);
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:27,代码来源:KualiInquiryAction.java


示例7: getCreateNewUrl

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
@Override
public String getCreateNewUrl() {
	String url = "";
	if((getLookupableHelperService()).allowsNewOrCopyAction(KimConstants.KimUIConstants.KIM_PERSON_DOCUMENT_TYPE_NAME)
			&& canModifyEntity(GlobalVariables.getUserSession().getPrincipalId(), null)){
        Properties parameters = new Properties();
        parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.DOC_HANDLER_METHOD);
        parameters.put(KRADConstants.PARAMETER_COMMAND, KewApiConstants.INITIATE_COMMAND);
        parameters.put(KRADConstants.DOCUMENT_TYPE_NAME, KimConstants.KimUIConstants.KIM_PERSON_DOCUMENT_TYPE_NAME);
        if (StringUtils.isNotBlank(getReturnLocation())) {
        	parameters.put(KRADConstants.RETURN_LOCATION_PARAMETER, getReturnLocation());
        	}
        url = getCreateNewUrl(UrlFactory.parameterizeUrl(
        		KimCommonUtilsInternal.getKimBasePath()+ KimConstants.KimUIConstants.KIM_PERSON_DOCUMENT_ACTION, parameters));
        //String url = "lookup.do?businessObjectClassName=org.kuali.rice.kim.bo.types.impl.KimTypeImpl&returnLocation=portal.do&docFormKey="+KimApiConstants.KimUIConstants.KIM_ROLE_DOCUMENT_SHORT_KEY;
        //url = "../kim/identityManagementPersonDocument.do?methodToCall=docHandler&command=initiate&docTypeName=IdentityManagementPersonDocument";
        //url = "<a title=\"Create a new record\" href=\"" + url + "\"><img src=\"images/tinybutton-createnew.gif\" alt=\"create new\" width=\"70\" height=\"15\"/></a>";
	}
	return url;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:PersonLookupableImpl.java


示例8: disapproveDocument

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.service.DocumentService#disapproveDocument(org.kuali.rice.krad.document.Document,
 *      java.lang.String)
 */
@Override
public Document disapproveDocument(Document document, String annotation) throws Exception {
    checkForNulls(document);

    Note note = createNoteFromDocument(document, annotation);
    //if note type is BO, override and link disapprove notes to Doc Header
    if (document.getNoteType().equals(NoteType.BUSINESS_OBJECT)) {
        note.setNoteTypeCode(NoteType.DOCUMENT_HEADER.getCode());
        note.setRemoteObjectIdentifier(document.getDocumentHeader().getObjectId());
    }
    document.addNote(note);

    //SAVE THE NOTE
    //Note: This save logic is replicated here and in KualiDocumentAction, when to save (based on doc state) should be moved
    //      into a doc service method
    getNoteService().save(note);

    prepareWorkflowDocument(document);
    getWorkflowDocumentService().disapprove(document.getDocumentHeader().getWorkflowDocument(), annotation);
    UserSessionUtils.addWorkflowDocument(GlobalVariables.getUserSession(),
            document.getDocumentHeader().getWorkflowDocument());
    removeAdHocPersonsAndWorkgroups(document);
    return document;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:DocumentServiceImpl.java


示例9: checkAuthorization

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
/**
 * Override this method to provide action-level access controls to the application.
 *
 * @param form
 * @throws AuthorizationException
 */
protected void checkAuthorization( ActionForm form, String methodToCall) throws AuthorizationException 
{
    String principalId = GlobalVariables.getUserSession().getPrincipalId();
    Map<String, String> roleQualifier = new HashMap<String, String>(getRoleQualification(form, methodToCall));
    Map<String, String> permissionDetails = KRADUtils.getNamespaceAndActionClass(this.getClass());
    
    if (!KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(principalId,
            KRADConstants.KNS_NAMESPACE, KimConstants.PermissionTemplateNames.USE_SCREEN, permissionDetails,
            roleQualifier))
    {
        throw new AuthorizationException(GlobalVariables.getUserSession().getPerson().getPrincipalName(), 
                methodToCall,
                this.getClass().getSimpleName());
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:KualiAction.java


示例10: getSections

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
/**
 * Objects extending KualiInquirableBase must specify the Section objects
 * used to display the inquiry result.
 */
@Deprecated
public List<Section> getSections(BusinessObject bo) {

	List<Section> sections = new ArrayList<Section>();
	if (getBusinessObjectClass() == null) {
		LOG.error("Business object class not set in inquirable.");
		throw new RuntimeException("Business object class not set in inquirable.");
	}

	InquiryRestrictions inquiryRestrictions = KNSServiceLocator.getBusinessObjectAuthorizationService()
			.getInquiryRestrictions(bo, GlobalVariables.getUserSession().getPerson());

	Collection<InquirySectionDefinition> inquirySections = getBusinessObjectDictionaryService().getInquirySections(
			getBusinessObjectClass());
	for (Iterator<InquirySectionDefinition> iter = inquirySections.iterator(); iter.hasNext();) {
		InquirySectionDefinition inquirySection = iter.next();
		if (!inquiryRestrictions.isHiddenSectionId(inquirySection.getId())) {
			Section section = SectionBridge.toSection(this, inquirySection, bo, inquiryRestrictions);
			sections.add(section);
		}
	}

	return sections;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:KualiInquirableImpl.java


示例11: prepareToReturnSelectedResultBOs

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
/**
 * This method performs the operations necessary for a multiple value lookup keep track of which results have been selected to be returned
 * to the calling document.  Note, this method does not actually requery for the results.
 * 
 * @param multipleValueLookupForm
 */
protected void prepareToReturnSelectedResultBOs(MultipleValueLookupForm multipleValueLookupForm) {
    String lookupResultsSequenceNumber = multipleValueLookupForm.getLookupResultsSequenceNumber();
    if (StringUtils.isBlank(lookupResultsSequenceNumber)) {
        // pressed return before searching
        return;
    }
    Map<String, String> compositeObjectIdMap = LookupUtils.generateCompositeSelectedObjectIds(multipleValueLookupForm.getPreviouslySelectedObjectIdSet(),
            multipleValueLookupForm.getDisplayedObjectIdSet(), multipleValueLookupForm.getSelectedObjectIdSet());
    Set<String> compositeObjectIds = compositeObjectIdMap.keySet();
    try {
        LookupResultsService lookupResultsService = KNSServiceLocator.getLookupResultsService();
        lookupResultsService.persistSelectedObjectIds(lookupResultsSequenceNumber, compositeObjectIds,
                GlobalVariables.getUserSession().getPerson().getPrincipalId());
    }
    catch (Exception e) {
        LOG.error("error occured trying to retrieve selected multiple lookup results", e);
        throw new RuntimeException("error occured trying to retrieve selected multiple lookup results");
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:KualiMultipleValueLookupAction.java


示例12: completeDocument

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.service.DocumentService#completeDocument(org.kuali.rice.krad.document.Document,
 *      java.lang.String,
 *      java.util.List)
 */
@Override
public Document completeDocument(Document document, String annotation,
        List adHocRecipients) throws WorkflowException {
    checkForNulls(document);

    document.prepareForSave();
    Document savedDocument = validateAndPersistDocument(document, new CompleteDocumentEvent(document));

    prepareWorkflowDocument(savedDocument);
    getWorkflowDocumentService().complete(savedDocument.getDocumentHeader().getWorkflowDocument(), annotation,
            adHocRecipients);

    UserSessionUtils.addWorkflowDocument(GlobalVariables.getUserSession(),
    		savedDocument.getDocumentHeader().getWorkflowDocument());

    removeAdHocPersonsAndWorkgroups(savedDocument);

    return savedDocument;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:DocumentServiceImpl.java


示例13: validateDocumentAttributeCriteria

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
@Override
public List<RemotableAttributeError> validateDocumentAttributeCriteria(ExtensionDefinition extensionDefinition,
        DocumentSearchCriteria documentSearchCriteria) {
    List<RemotableAttributeError> validationErrors = new ArrayList<RemotableAttributeError>();
    DictionaryValidationService validationService = KNSServiceLocator.getKNSDictionaryValidationService();
    RunMode kewRunMode = RunMode.valueOf(ConfigContext.getCurrentContextConfig().getProperty(KEW_RUN_MODE_PROPERTY));
    if (kewRunMode != RunMode.LOCAL) {
        GlobalVariables.getMessageMap().clearErrorMessages();
    }
    // validate the document attribute values
    Map<String, List<String>> documentAttributeValues = documentSearchCriteria.getDocumentAttributeValues();
    for (String key : documentAttributeValues.keySet()) {
        List<String> values = documentAttributeValues.get(key);
        if (CollectionUtils.isNotEmpty(values)) {
            for (String value : values) {
                if (StringUtils.isNotBlank(value)) {
                    validationService.validateAttributeFormat(documentSearchCriteria.getDocumentTypeName(), key, value, key);
                }
            }
        }
    }

    retrieveValidationErrorsFromGlobalVariables(validationErrors);

    return validationErrors;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:27,代码来源:DataDictionarySearchableAttribute.java


示例14: testUserRouteLogAuthenticated

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
/**
 * Tests EDLFunctions.isUserRouteLogAuthenticated
 */
@Test public void testUserRouteLogAuthenticated() throws Exception {
	String user1PrincipalId = getPrincipalIdForName("user1");

	WorkflowDocument document = WorkflowDocumentFactory.createDocument(user1PrincipalId, DOCUMENT_TYPE_NAME);
	document.route("");

	// ensure the UserSession is cleared out (could have been set up by other tests)
	GlobalVariables.setUserSession(null);

    // false because we didn't set up the user session properly
    assertFalse(EDLFunctions.isUserRouteLogAuthenticated(document.getDocumentId() + ""));

    // these two should be in the route log
    GlobalVariables.setUserSession(new UserSession("user1"));
    assertTrue(EDLFunctions.isUserRouteLogAuthenticated(document.getDocumentId() + ""));
    GlobalVariables.setUserSession(new UserSession("bmcgough"));
    assertTrue(EDLFunctions.isUserRouteLogAuthenticated(document.getDocumentId() + ""));

    // user2 should NOT be in the route log
    GlobalVariables.setUserSession(new UserSession("user2"));
    assertFalse(EDLFunctions.isUserRouteLogAuthenticated(document.getDocumentId() + ""));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:RouteLogAuthenticationTest.java


示例15: processErrorMessages

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
/**
 * This method handles processing any error messages coming in the door.
 *
 * @param request
 */
private void processErrorMessages(HttpServletRequest request) {
    String errorKey = request.getParameter(KRADConstants.QUESTION_ERROR_KEY);
    String errorPropertyName = request.getParameter(KRADConstants.QUESTION_ERROR_PROPERTY_NAME);
    String errorParameter = request.getParameter(KRADConstants.QUESTION_ERROR_PARAMETER);

    if (StringUtils.isNotBlank(errorKey)) {
        if (StringUtils.isBlank(errorPropertyName)) {
            throw new IllegalStateException("Both the errorKey and the errorPropertyName must be filled in, " + "in order for errors to be displayed by the question component.  Currently, " + "only the errorKey has a value specified.");
        }
        else {
            if (StringUtils.isBlank(errorParameter)) {
                GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(errorPropertyName, errorKey);
            }
            else {
                GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(errorPropertyName, errorKey, errorParameter);
            }
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:QuestionPromptAction.java


示例16: isAdHocRouteRecipientsValid

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
/**
 * Checks the adhoc route recipient list to ensure there are recipients or
 * else throws an error that at least one recipient is required.
 *
 * @param document
 * @return true if all adhoc route recipients are valid
 */
protected boolean isAdHocRouteRecipientsValid(Document document) {
    boolean isValid = true;
    MessageMap errorMap = GlobalVariables.getMessageMap();

    if (errorMap.getErrorPath().size() == 0) {
        // add the error path keys on the stack
        errorMap.addToErrorPath(KRADConstants.NEW_AD_HOC_ROUTE_PERSON_PROPERTY_NAME);
    }

    if ((document.getAdHocRoutePersons() == null || document.getAdHocRoutePersons().isEmpty()) && (document
            .getAdHocRouteWorkgroups() == null || document.getAdHocRouteWorkgroups().isEmpty())) {

        GlobalVariables.getMessageMap().putError(KRADPropertyConstants.ID, "error.adhoc.missing.recipients");
        isValid = false;
    }

    // drop the error path keys off now
    errorMap.removeFromErrorPath(KRADConstants.NEW_AD_HOC_ROUTE_PERSON_PROPERTY_NAME);

    return isValid;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:DocumentRuleBase.java


示例17: isDocumentOverviewValid

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
/**
 * Verifies that the document's overview fields are valid - it does required and format checks.
 *
 * @param document
 * @return boolean True if the document description is valid, false otherwise.
 */
public boolean isDocumentOverviewValid(Document document) {
    // add in the documentHeader path
    GlobalVariables.getMessageMap().addToErrorPath(KRADConstants.DOCUMENT_PROPERTY_NAME);
    GlobalVariables.getMessageMap().addToErrorPath(KRADConstants.DOCUMENT_HEADER_PROPERTY_NAME);

    // check the document header for fields like the description
    getDictionaryValidationService().validateBusinessObject(document.getDocumentHeader());
    validateSensitiveDataValue(KRADPropertyConstants.EXPLANATION, document.getDocumentHeader().getExplanation(),
            getDataDictionaryService().getAttributeLabel(DocumentHeader.class, KRADPropertyConstants.EXPLANATION));
    validateSensitiveDataValue(KRADPropertyConstants.DOCUMENT_DESCRIPTION,
            document.getDocumentHeader().getDocumentDescription(), getDataDictionaryService().getAttributeLabel(
            DocumentHeader.class, KRADPropertyConstants.DOCUMENT_DESCRIPTION));

    // drop the error path keys off now
    GlobalVariables.getMessageMap().removeFromErrorPath(KRADConstants.DOCUMENT_HEADER_PROPERTY_NAME);
    GlobalVariables.getMessageMap().removeFromErrorPath(KRADConstants.DOCUMENT_PROPERTY_NAME);

    return GlobalVariables.getMessageMap().hasNoErrors();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:DocumentRuleBase.java


示例18: validateDuplicateIdentifierInDataDictionary

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
/**
 * This method validates that there should only exist one entry in the collection whose
 * fields match the fields specified within the duplicateIdentificationFields in the
 * maintenance document data dictionary.
 * If the duplicateIdentificationFields is not specified in the DD, by default it would
 * allow the addition to happen and return true.
 * It will return false if it fails the uniqueness validation.
 *
 * @param document
 * @param collectionName
 * @param bo
 * @return
 */
protected boolean validateDuplicateIdentifierInDataDictionary(MaintenanceDocument document, String collectionName,
        PersistableBusinessObject bo) {
    boolean valid = true;
    Object maintBo = document.getNewMaintainableObject().getDataObject();
    Collection maintCollection = (Collection) ObjectUtils.getPropertyValue(maintBo, collectionName);
    List<String> duplicateIdentifier = document.getNewMaintainableObject()
            .getDuplicateIdentifierFieldsFromDataDictionary(
                    document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName(), collectionName);
    if (duplicateIdentifier.size() > 0) {
        List<String> existingIdentifierString = document.getNewMaintainableObject()
                .getMultiValueIdentifierList(maintCollection, duplicateIdentifier);
        if (document.getNewMaintainableObject()
                .hasBusinessObjectExisted(bo, existingIdentifierString, duplicateIdentifier)) {
            valid = false;
            GlobalVariables.getMessageMap()
                    .putError(duplicateIdentifier.get(0), RiceKeyConstants.ERROR_DUPLICATE_ELEMENT, "entries in ",
                            document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName());
        }
    }
    return valid;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:35,代码来源:MaintenanceDocumentRuleBase.java


示例19: testRecursiveValidation

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
/**
 * This method tests recursive validation at a depth of zero
 *
 * @throws Exception
 */
@Test public void testRecursiveValidation() throws Exception {
    AccountRequestDocument travelDocument = (AccountRequestDocument) KRADServiceLocatorWeb.getDocumentService().getNewDocument("AccountRequest");
    // set all required fields except 1
    travelDocument.getDocumentHeader().setDocumentDescription("test document");
    travelDocument.setReason1("reason1");
    travelDocument.setReason2("reason2");
    travelDocument.setRequester("requester");

    GlobalVariables.setMessageMap(new MessageMap());
    KRADServiceLocatorWeb.getDictionaryValidationService().validateDocumentAndUpdatableReferencesRecursively(travelDocument, 0, true);
    MessageMap errorMap = GlobalVariables.getMessageMap();
    int recursiveZeroMessageMapSize = errorMap.getNumberOfPropertiesWithErrors();

    // errors should be 'account type code' and 'request type' both being required
    assertEquals("Number of errors found is incorrect", 2, recursiveZeroMessageMapSize);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:DictionaryValidationServiceTest.java


示例20: testRecursiveValidationMultiple

import org.kuali.rice.krad.util.GlobalVariables; //导入依赖的package包/类
/**
 * This method tests recursive validation comparing multiple levels of recursion
 *
 * @throws Exception
 */
@Test public void testRecursiveValidationMultiple() throws Exception {
    AccountRequestDocument travelDocument = (AccountRequestDocument) KRADServiceLocatorWeb.getDocumentService().getNewDocument("AccountRequest");
    // set all required fields except 1
    travelDocument.getDocumentHeader().setDocumentDescription("test document");
    travelDocument.setReason1("reason1");
    travelDocument.setReason2("reason2");
    travelDocument.setRequester("requester");

    GlobalVariables.setMessageMap(new MessageMap());
    KRADServiceLocatorWeb.getDictionaryValidationService().validateDocumentAndUpdatableReferencesRecursively(travelDocument, 0, true);
    MessageMap errorMap = GlobalVariables.getMessageMap();
    int recursiveZeroMessageMapSize = errorMap.getNumberOfPropertiesWithErrors();

    GlobalVariables.setMessageMap(new MessageMap());
    KRADServiceLocatorWeb.getDictionaryValidationService().validateDocumentAndUpdatableReferencesRecursively(travelDocument, 5, true);
    MessageMap errorMap2 = GlobalVariables.getMessageMap();
    int recursiveFiveMessageMapSize = errorMap2.getNumberOfPropertiesWithErrors();

    assertEquals("We should get the same number of errors no matter how deeply we recursively validate for this document", recursiveZeroMessageMapSize, recursiveFiveMessageMapSize);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:DictionaryValidationServiceTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ColumnQuery类代码示例发布时间:2022-05-23
下一篇:
Java Datas类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap