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


Java KimApiServiceLocator.getRoleService方法代码示例

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


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

示例1: getAssignedRoleInquiryUrl

import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入方法依赖的package包/类
protected HtmlData getAssignedRoleInquiryUrl(BusinessObject businessObject){
  	UberPermissionBo permission = (UberPermissionBo)businessObject;
  	List<RoleBo> assignedToRoles = permission.getAssignedToRoles();
  	List<HtmlData.AnchorHtmlData> htmlData = new ArrayList<HtmlData.AnchorHtmlData>();
if(assignedToRoles!=null && !assignedToRoles.isEmpty()){
	RoleService roleService = KimApiServiceLocator.getRoleService();
	for(RoleBo roleImpl: assignedToRoles){
		Role roleInfo = roleService.getRole(roleImpl.getId());
		HtmlData.AnchorHtmlData inquiryHtmlData = getInquiryUrlForPrimaryKeys(RoleBo.class, roleInfo, Collections.singletonList(ID),
      				roleInfo.getNamespaceCode()+ " " + roleInfo.getName());
		inquiryHtmlData.setHref(RoleLookupableHelperServiceImpl.getCustomRoleInquiryHref(inquiryHtmlData.getHref()));
		inquiryHtmlData.setTarget(HtmlData.AnchorHtmlData.TARGET_BLANK);
      		htmlData.add(inquiryHtmlData);
      	}
}
  	return new HtmlData.MultipleAnchorHtmlData(htmlData);
  }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:PermissionInquirableImpl.java

示例2: getAssignedRoleInquiryUrl

import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入方法依赖的package包/类
protected HtmlData getAssignedRoleInquiryUrl(BusinessObject businessObject){
  	UberResponsibilityBo responsibility = (UberResponsibilityBo)businessObject;
  	List<RoleBo> assignedToRoles = responsibility.getAssignedToRoles();
  	List<HtmlData.AnchorHtmlData> htmlData = new ArrayList<HtmlData.AnchorHtmlData>();
if(assignedToRoles!=null && !assignedToRoles.isEmpty()){
	List<String> primaryKeys = Collections.singletonList(ID);
	RoleService roleService = KimApiServiceLocator.getRoleService();
	for(RoleBo roleImpl: assignedToRoles){
		Role role = roleService.getRole(roleImpl.getId());
		HtmlData.AnchorHtmlData inquiryHtmlData = getInquiryUrlForPrimaryKeys(RoleBo.class, role, primaryKeys,
      				role.getNamespaceCode()+" "+
      				role.getName());
		inquiryHtmlData.setHref(RoleLookupableHelperServiceImpl.getCustomRoleInquiryHref(inquiryHtmlData.getHref()));
      		htmlData.add(inquiryHtmlData);
      	}
}
  	return new HtmlData.MultipleAnchorHtmlData(htmlData);
  }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:ResponsibilityInquirableImpl.java

示例3: isDynamicRoleMembership

import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入方法依赖的package包/类
/**
 * Used for a caching condition to determine if a role passed to a method is derived or not.
 *
 * @param roleIds list of role id values
 *
 * @return true if list contains a derived role.
 */
public static boolean isDynamicRoleMembership(List<String> roleIds) {
    if (CollectionUtils.isEmpty(roleIds)) {
        return false;
    }
    RoleService roleService = KimApiServiceLocator.getRoleService();
    for (String roleId : roleIds) {
         if (roleService.isDynamicRoleMembership(roleId)) {
             return true;
         }
    }
    return false;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:KimCacheUtils.java

示例4: getRoleService

import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入方法依赖的package包/类
/**
 * @return the roleService
 */
public RoleService getRoleService() {
	if ( roleService == null ) {
		roleService = KimApiServiceLocator.getRoleService();
	}
	return roleService;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:10,代码来源:DocumentConfigurationViewAction.java

示例5: getRoleService

import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入方法依赖的package包/类
/**
 * @return the roleService
 */
   protected static RoleService getRoleService() {
	if ( roleService == null ) {
		roleService = KimApiServiceLocator.getRoleService();
	}
	return roleService;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:10,代码来源:ActionRequestFactory.java

示例6: testDynamicRoleCacheability

import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入方法依赖的package包/类
@Test
public void testDynamicRoleCacheability() {
    RoleService roleService = KimApiServiceLocator.getRoleService();
    Role r = roleService.getRoleByNamespaceCodeAndName("KR-WKFLW", "Approve Request Recipient");
    assertTrue(roleService.isDynamicRoleMembership(r.getId()));
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "ActionRequestDerivedRoleTypeServiceImplTest");

    // let's send an adhoc request to rkirkend
    String rkirkend = getPrincipalIdForName("rkirkend");
    document.adHocToPrincipal(ActionRequestType.APPROVE, "ad-hoc-ing will result in request to member of derive role",
            rkirkend, "approve this ad-hoc'd doc responsibility", true);
    document.route("");

    RoleTypeService roleTypeService = new ActionRequestDerivedRoleTypeServiceImpl();

    Map<String, String> qualifications = Collections.singletonMap(KimConstants.AttributeConstants.DOCUMENT_NUMBER, document.getDocumentId());

    // rkirkend should have role as an approver
    assertTrue("rkirkend should have role.", roleTypeService.hasDerivedRole(rkirkend, null, null, APPROVE_REQUEST_RECIPIENT_ROLE_NAME, qualifications));

    boolean firstResult = roleService.principalHasRole(rkirkend, Arrays.asList(new String[]{r.getId()}), qualifications);
    assertTrue(firstResult);

    document = WorkflowDocumentFactory.loadDocument(rkirkend, document.getDocumentId());
    document.approve("approved ad-hoc request. rkirkend is no longer a derived approver!");

    // rkirkend should no longer have role as an approver
    assertFalse("rkirkend should have NO LONGER have derived approver role.", roleTypeService.hasDerivedRole(rkirkend, null, null, APPROVE_REQUEST_RECIPIENT_ROLE_NAME, qualifications));
    boolean afterApprove = roleService.principalHasRole(rkirkend, Arrays.asList(new String[]{r.getId()}), qualifications);
    assertFalse(afterApprove);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:32,代码来源:ActionRequestDerivedRoleTypeServiceImplTest.java

示例7: createFirstApproveRolePeopleFlow

import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入方法依赖的package包/类
/**
 * Defines a PeopleFlow with a single first approve role, that role has two members, one principal and one group.
 */
private void createFirstApproveRolePeopleFlow() {
    RoleService roleService = KimApiServiceLocator.getRoleService();
    Role role = roleService.getRoleByNamespaceCodeAndName("KR-SYS", "Technical Administrator");
    assertNotNull("Technical Administrator role should exist!", role);
    assertEquals(2, roleService.getRoleMembers(Collections.singletonList(role.getId()),
            new HashMap<String, String>()).size());
    roleId = role.getId();

    PeopleFlowDefinition.Builder peopleFlow = PeopleFlowDefinition.Builder.create(NAMESPACE_CODE, PEOPLE_FLOW_2);
    PeopleFlowMember.Builder memberBuilder = peopleFlow.addRole(role.getId());
    memberBuilder.setPriority(1);
    memberBuilder.setActionRequestPolicy(ActionRequestPolicy.FIRST);
    peopleFlowService.createPeopleFlow(peopleFlow.build());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:PeopleFlowRoutingTest.java

示例8: createAllApproveRolePeopleFlow

import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入方法依赖的package包/类
/**
 * Defines a PeopleFlow with a single all approve role, that role has two members, one principal and one group.
 */
private void createAllApproveRolePeopleFlow() {
    RoleService roleService = KimApiServiceLocator.getRoleService();
    Role role = roleService.getRoleByNamespaceCodeAndName("KR-SYS", "Technical Administrator");
    assertNotNull("Technical Administrator role should exist!", role);
    assertEquals(2, roleService.getRoleMembers(Collections.singletonList(role.getId()),
            new HashMap<String, String>()).size());
    roleId = role.getId();

    PeopleFlowDefinition.Builder peopleFlow = PeopleFlowDefinition.Builder.create(NAMESPACE_CODE, PEOPLE_FLOW_2);
    PeopleFlowMember.Builder memberBuilder = peopleFlow.addRole(role.getId());
    memberBuilder.setPriority(1);
    memberBuilder.setActionRequestPolicy(ActionRequestPolicy.ALL);
    peopleFlowService.createPeopleFlow(peopleFlow.build());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:PeopleFlowRoutingTest.java

示例9: removeRoleMembers

import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入方法依赖的package包/类
/**
 * Removes any role members for a given role whose IDs are not listed in a given role member ID set.
 * 
 * @param roleId The ID of the role containing the role members.
 * @param existingRoleMemberIds The IDs of the role members that should not be removed.
 * @throws IllegalArgumentException if roleId is blank or refers to a non-existent role, or if existingRoleMemberIds is null.
 */
static void removeRoleMembers(String roleId, Set<String> existingRoleMemberIds) {
    if (StringUtils.isBlank(roleId)) {
        throw new IllegalArgumentException("roleId cannot be blank");
    } else if (existingRoleMemberIds == null) {
        throw new IllegalArgumentException("existingRoleMemberIds cannot be null");
    }
    RoleService roleUpdateService = KimApiServiceLocator.getRoleService();
    RoleContract role = KimApiServiceLocator.getRoleService().getRole(roleId);
    if (role == null) {
        throw new IllegalArgumentException("Cannot remove role members for role with ID \"" + roleId + "\" because that role does not exist");
    }
    
    // Remove any role members whose IDs are not in the set.
    List<RoleMember> roleMembers = KimApiServiceLocator.getRoleService().findRoleMembers(
            QueryByCriteria.Builder.fromPredicates(equal("roleId", roleId))).getResults();
    if (roleMembers != null && !roleMembers.isEmpty()) {
        for (RoleMemberContract roleMember : roleMembers) {
            if (!existingRoleMemberIds.contains(roleMember.getId())) {
                // If the role member needs to be removed, use the member type code to determine which removal method to call.
                MemberType memberType = roleMember.getType();
                if (MemberType.PRINCIPAL.equals(memberType)) {
                    roleUpdateService.removePrincipalFromRole(roleMember.getMemberId(), role.getNamespaceCode(), role.getName(),
                            (roleMember.getAttributes() != null) ? roleMember.getAttributes() : new HashMap<String, String>());
                } else if (MemberType.GROUP.equals(memberType)) {
                    roleUpdateService.removeGroupFromRole(roleMember.getMemberId(), role.getNamespaceCode(), role.getName(),
                            (roleMember.getAttributes() != null) ? roleMember.getAttributes() :new HashMap<String, String>());
                } else if (MemberType.ROLE.equals(memberType)) {
                    roleUpdateService.removeRoleFromRole(roleMember.getMemberId(), role.getNamespaceCode(), role.getName(),
                            (roleMember.getAttributes() != null) ? roleMember.getAttributes() : new HashMap<String, String>());
                }
            }
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:42,代码来源:RoleXmlUtil.java

示例10: getRoleService

import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入方法依赖的package包/类
protected RoleService getRoleService() {
    if (this.roleService == null) {
        this.roleService = KimApiServiceLocator.getRoleService();
    }
    return this.roleService;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:7,代码来源:MaintenanceDocumentRuleBase.java

示例11: getKimRoleService

import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入方法依赖的package包/类
protected RoleService getKimRoleService() {
    if ( kimRoleService == null ) {
        kimRoleService = KimApiServiceLocator.getRoleService();
    }
    return kimRoleService;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:7,代码来源:KimRemoteModuleService.java

示例12: getRoleService

import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入方法依赖的package包/类
protected RoleService getRoleService() {
	if ( roleService == null ) {
		roleService = KimApiServiceLocator.getRoleService();
	}
	return roleService;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:7,代码来源:PersonServiceImpl.java

示例13: getRoleService

import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入方法依赖的package包/类
protected RoleService getRoleService() {
   	if(roleService == null){
   		roleService = KimApiServiceLocator.getRoleService();
   	}
	return roleService;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:7,代码来源:UiDocumentServiceImpl.java

示例14: getKimRoleService

import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入方法依赖的package包/类
protected RoleService getKimRoleService() {
	if ( kimRoleService == null ) {
		kimRoleService = KimApiServiceLocator.getRoleService();
	}
	return kimRoleService;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:7,代码来源:KimModuleService.java

示例15: getRoleService

import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入方法依赖的package包/类
public synchronized RoleService getRoleService() {
	if (roleService == null) {
		roleService = KimApiServiceLocator.getRoleService();
	}
	return roleService;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:7,代码来源:PermissionLookupableHelperServiceImpl.java


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