本文整理汇总了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;
}
示例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;
}