當前位置: 首頁>>代碼示例>>Java>>正文


Java GenericPermissionBo.getDetails方法代碼示例

本文整理匯總了Java中org.kuali.rice.kim.impl.permission.GenericPermissionBo.getDetails方法的典型用法代碼示例。如果您正苦於以下問題:Java GenericPermissionBo.getDetails方法的具體用法?Java GenericPermissionBo.getDetails怎麽用?Java GenericPermissionBo.getDetails使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.kuali.rice.kim.impl.permission.GenericPermissionBo的用法示例。


在下文中一共展示了GenericPermissionBo.getDetails方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processCustomRouteDocumentBusinessRules

import org.kuali.rice.kim.impl.permission.GenericPermissionBo; //導入方法依賴的package包/類
@Override
protected boolean processCustomRouteDocumentBusinessRules(MaintenanceDocument document) {
	boolean rulesPassed = super.processCustomRouteDocumentBusinessRules( document );
	try {
		GenericPermissionBo newPerm = (GenericPermissionBo)getNewBo();
           GenericPermissionBo oldPerm = (GenericPermissionBo)getOldBo();
		rulesPassed &= validateDetailValuesFormat(newPerm.getDetailValues());
           if(StringUtils.isNotBlank(newPerm.getNamespaceCode()) && StringUtils.isNotBlank(newPerm.getName()) && StringUtils.isBlank(newPerm.getId())){
               rulesPassed &= validateNamespaceCodeAndName(newPerm.getNamespaceCode(), newPerm.getName());
           }
           // rule case for copy
           if(StringUtils.isNotBlank(newPerm.getNamespaceCode()) &&
              StringUtils.isNotBlank(newPerm.getName()) &&
              StringUtils.isNotBlank(oldPerm.getId()) &&
              StringUtils.isNotBlank(newPerm.getId()) &&
              !StringUtils.equals(oldPerm.getId(), newPerm.getId())){
                 rulesPassed &= validateNamespaceCodeAndName(newPerm.getNamespaceCode(), newPerm.getName());
           }
           // rule case for edit
           if(StringUtils.isNotBlank(newPerm.getNamespaceCode()) &&
                   StringUtils.isNotBlank(newPerm.getName()) &&
                   StringUtils.isNotBlank(oldPerm.getId()) &&
                   StringUtils.isNotBlank(newPerm.getId()) &&
                   StringUtils.equals(oldPerm.getId(), newPerm.getId()) &&
                   ( !StringUtils.equals(oldPerm.getNamespaceCode(), newPerm.getNamespaceCode()) ||
                     !StringUtils.equals(oldPerm.getName(), newPerm.getName())
                   )
              ) {
               rulesPassed &= validateNamespaceCodeAndName(newPerm.getNamespaceCode(), newPerm.getName());
           }
		// detailValues
		// get the type from the template for validation
           if(StringUtils.isNotBlank(newPerm.getTemplateId())){
               Template template = KimApiServiceLocator.getPermissionService().getPermissionTemplate(newPerm.getTemplateId());
               if ( template == null ) {
                   GlobalVariables.getMessageMap().addToErrorPath( MAINTAINABLE_ERROR_PATH );
                   GlobalVariables.getMessageMap().putError( DETAIL_VALUES_PROPERTY, ERROR_MISSING_TEMPLATE, newPerm.getTemplateId() );
                   GlobalVariables.getMessageMap().removeFromErrorPath( MAINTAINABLE_ERROR_PATH );
                   rulesPassed &= false;
               } else {
                   KimType kimType = KimApiServiceLocator.getKimTypeInfoService().getKimType(template.getKimTypeId());
                   Map<String, String> details = newPerm.getDetails();
                   // check that add passed attributes are defined
                   for ( String attributeName : details.keySet() ) {
                       if ( kimType.getAttributeDefinitionByName(attributeName) == null ) {
                           GlobalVariables.getMessageMap().addToErrorPath( MAINTAINABLE_ERROR_PATH );
                           GlobalVariables.getMessageMap().putError( DETAIL_VALUES_PROPERTY, ERROR_UNKNOWN_ATTRIBUTE, attributeName, template.getNamespaceCode(), template.getName() );
                           GlobalVariables.getMessageMap().removeFromErrorPath( MAINTAINABLE_ERROR_PATH );
                           rulesPassed &= false;
                       }
                   }
                   // if all attributes are known, pass to the service for validation
                   if ( !GlobalVariables.getMessageMap().hasErrors() ) {
                       PermissionTypeService service = getPermissionTypeService( kimType.getServiceName() );
                       if ( service != null ) {
                           List<RemotableAttributeError> validationErrors = service.validateAttributes( kimType.getId(), details);
                           if ( validationErrors != null && !validationErrors.isEmpty() ) {
                               for ( RemotableAttributeError error : validationErrors ) {
                                   GlobalVariables.getMessageMap().addToErrorPath( MAINTAINABLE_ERROR_PATH );
                                   for (String errMsg : error.getErrors()) {
                                       GlobalVariables.getMessageMap().putError( DETAIL_VALUES_PROPERTY, ERROR_ATTRIBUTE_VALIDATION, error.getAttributeName(), errMsg );
                                   }
                                   GlobalVariables.getMessageMap().removeFromErrorPath( MAINTAINABLE_ERROR_PATH );
                               }
                               rulesPassed &= false;
                           }
                       }
                   }

               }

           }
		// check each permission name against the type
	} catch ( RuntimeException ex ) {
		LOG.error( "Error in processCustomRouteDocumentBusinessRules()", ex );
		throw ex;
	}
	return rulesPassed;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:80,代碼來源:GenericPermissionMaintenanceDocumentRule.java

示例2: processCustomRouteDocumentBusinessRules

import org.kuali.rice.kim.impl.permission.GenericPermissionBo; //導入方法依賴的package包/類
@Override
protected boolean processCustomRouteDocumentBusinessRules(MaintenanceDocument document) {
	boolean rulesPassed = super.processCustomRouteDocumentBusinessRules( document );
	try {
		GenericPermissionBo perm = (GenericPermissionBo)getNewBo();
           GenericPermissionBo orgBo = (GenericPermissionBo)getOldBo();
		rulesPassed &= validateDetailValuesFormat(perm.getDetailValues());
           if(StringUtils.isNotBlank(perm.getNamespaceCode()) && StringUtils.isNotBlank(perm.getName()) && StringUtils.isBlank(perm.getId())){
               rulesPassed &= validateNamespaceCodeAndName(perm.getNamespaceCode(), perm.getName());
           }
           // rule case for copy
           if(StringUtils.isNotBlank(perm.getNamespaceCode()) &&
              StringUtils.isNotBlank(perm.getName()) &&
              StringUtils.isNotBlank(orgBo.getId()) &&
              StringUtils.isNotBlank(perm.getId()) &&
              !StringUtils.equals(orgBo.getId(), perm.getId())){
                 rulesPassed &= validateNamespaceCodeAndName(perm.getNamespaceCode(), perm.getName());
           }
           // rule case for edit
           if(StringUtils.isNotBlank(perm.getNamespaceCode()) &&
                   StringUtils.isNotBlank(perm.getName()) &&
                   StringUtils.isNotBlank(orgBo.getId()) &&
                   StringUtils.isNotBlank(perm.getId()) &&
                   StringUtils.equals(orgBo.getId(), perm.getId()) &&
                   ( !StringUtils.equals(orgBo.getNamespaceCode(), perm.getNamespaceCode()) ||
                     !StringUtils.equals(orgBo.getName(), perm.getName())
                   )
              ) {
               rulesPassed &= validateNamespaceCodeAndName(perm.getNamespaceCode(), perm.getName());
           }
		// detailValues
		// get the type from the template for validation
           Template template = null;
           if(StringUtils.isNotBlank(perm.getTemplateId())){
                template =   KimApiServiceLocator.getPermissionService().getPermissionTemplate(perm.getTemplateId());
               if ( template == null ) {
                   GlobalVariables.getMessageMap().addToErrorPath( MAINTAINABLE_ERROR_PATH );
                   GlobalVariables.getMessageMap().putError( DETAIL_VALUES_PROPERTY, ERROR_MISSING_TEMPLATE, perm.getTemplateId() );
                   GlobalVariables.getMessageMap().removeFromErrorPath( MAINTAINABLE_ERROR_PATH );
                   rulesPassed &= false;
               } else {
                   KimType kimType = KimApiServiceLocator.getKimTypeInfoService().getKimType(template.getKimTypeId());
                   Map<String, String> details = perm.getDetails();
                   // check that add passed attributes are defined
                   for ( String attributeName : details.keySet() ) {
                       if ( kimType.getAttributeDefinitionByName(attributeName) == null ) {
                           GlobalVariables.getMessageMap().addToErrorPath( MAINTAINABLE_ERROR_PATH );
                           GlobalVariables.getMessageMap().putError( DETAIL_VALUES_PROPERTY, ERROR_UNKNOWN_ATTRIBUTE, attributeName, template.getNamespaceCode(), template.getName() );
                           GlobalVariables.getMessageMap().removeFromErrorPath( MAINTAINABLE_ERROR_PATH );
                           rulesPassed &= false;
                       }
                   }
                   // if all attributes are known, pass to the service for validation
                   if ( !GlobalVariables.getMessageMap().hasErrors() ) {
                       PermissionTypeService service = getPermissionTypeService( kimType.getServiceName() );
                       if ( service != null ) {
                           List<RemotableAttributeError> validationErrors = service.validateAttributes( kimType.getId(), details);
                           if ( validationErrors != null && !validationErrors.isEmpty() ) {
                               for ( RemotableAttributeError error : validationErrors ) {
                                   GlobalVariables.getMessageMap().addToErrorPath( MAINTAINABLE_ERROR_PATH );
                                   for (String errMsg : error.getErrors()) {
                                       GlobalVariables.getMessageMap().putError( DETAIL_VALUES_PROPERTY, ERROR_ATTRIBUTE_VALIDATION, error.getAttributeName(), errMsg );
                                   }
                                   GlobalVariables.getMessageMap().removeFromErrorPath( MAINTAINABLE_ERROR_PATH );
                               }
                               rulesPassed &= false;
                           }
                       }
                   }

               }

           }
		// check each permission name against the type
	} catch ( RuntimeException ex ) {
		LOG.error( "Error in processCustomRouteDocumentBusinessRules()", ex );
		throw ex;
	}
	return rulesPassed;
}
 
開發者ID:aapotts,項目名稱:kuali_rice,代碼行數:81,代碼來源:GenericPermissionMaintenanceDocumentRule.java


注:本文中的org.kuali.rice.kim.impl.permission.GenericPermissionBo.getDetails方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。