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


Java RoleRecipient类代码示例

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


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

示例1: getRecipient

import org.kuali.rice.kew.user.RoleRecipient; //导入依赖的package包/类
/**
 * Convenience method to return the Recipient for this RuleResponsibility
 * @return the Recipient for this RuleResponsibility
 */
public Recipient getRecipient() {
    if (isUsingPrincipal()) {
        return new KimPrincipalRecipient(getPrincipal());
    } else if (isUsingGroup()) {
        return new KimGroupRecipient(getGroup());
    } else if (isUsingRole()) {
        return new RoleRecipient(getRole());
    } else {
        return null;
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:RuleResponsibilityBo.java

示例2: addDelegationRoleRequest

import org.kuali.rice.kew.user.RoleRecipient; //导入依赖的package包/类
public ActionRequestValue addDelegationRoleRequest(ActionRequestValue parentRequest, String approvePolicy, RoleRecipient role, String responsibilityId, Boolean forceAction, DelegationType delegationType, String description, String ruleId) {
 	Recipient parentRecipient = parentRequest.getRecipient();
 	if (parentRecipient instanceof RoleRecipient) {
 		throw new WorkflowRuntimeException("Cannot delegate on Role Request.  It must be a request to a person or workgroup, although that request may be in a role");
 	}
 	if (! relatedToRoot(parentRequest)) {
 		throw new WorkflowRuntimeException("The parent request is not related to any request managed by this factory");
 	}
 	ActionRequestValue delegationRoleRequest = createActionRequest(parentRequest.getActionRequested(), parentRequest.getPriority(), role, description, responsibilityId, forceAction, approvePolicy, ruleId, null);
 	delegationRoleRequest.setDelegationType(delegationType);
 	int count = 0;
 	for (Iterator<Id> iter = role.getResolvedQualifiedRole().getRecipients().iterator(); iter.hasNext(); count++) {
 		//repeat of createRoleRequest code
 		Id recipientId = iter.next();
 		if (recipientId.isEmpty()) {
	throw new WorkflowRuntimeException("Failed to resolve id of type " + recipientId.getClass().getName() + " returned from role '" + role.getRoleName() + "'.  Id returned contained a null or empty value.");
}
if (recipientId instanceof UserId) {
	role.setTarget(new KimPrincipalRecipient(getIdentityHelperService().getPrincipal((UserId) recipientId)));
} else if (recipientId instanceof GroupId) {
    role.setTarget(new KimGroupRecipient(getIdentityHelperService().getGroup((GroupId) recipientId)));
} else {
	throw new WorkflowRuntimeException("Could not process the given type of id: " + recipientId.getClass());
}
ActionRequestValue request = createActionRequest(parentRequest.getActionRequested(), parentRequest.getPriority(), role, description, responsibilityId, forceAction, null, ruleId, null);
request.setDelegationType(delegationType);
//end repeat
request.setParentActionRequest(delegationRoleRequest);
delegationRoleRequest.getChildrenRequests().add(request);
 	}

 	//put this mini graph in the larger graph
 	if (count > 0) {
 		parentRequest.getChildrenRequests().add(delegationRoleRequest);
 		delegationRoleRequest.setParentActionRequest(parentRequest);
 	}

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

示例3: getRecipient

import org.kuali.rice.kew.user.RoleRecipient; //导入依赖的package包/类
public Recipient getRecipient() {
    if (getPrincipalId() != null) {
        return new KimPrincipalRecipient(getPrincipal());
    } else if (getGroupId() != null){
        return new KimGroupRecipient(getGroup());
    } else {
    	return new RoleRecipient(this.getRoleName());
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:10,代码来源:ActionRequestValue.java

示例4: makeRoleActionRequests

import org.kuali.rice.kew.user.RoleRecipient; //导入依赖的package包/类
/**
 * Generates action requests for a role responsibility
 */
private void makeRoleActionRequests(ActionRequestFactory arFactory, RouteContext context, 
		org.kuali.rice.kew.api.rule.Rule rule, org.kuali.rice.kew.api.rule.RuleResponsibility resp, DocumentRouteHeaderValue routeHeader, ActionRequestValue parentRequest,
		RuleDelegation ruleDelegation)
{
	String roleName = resp.getResolvedRoleName();
	//RoleAttribute roleAttribute = resp.resolveRoleAttribute();
       RoleAttribute roleAttribute = null;
       if (resp.isUsingRole()) {
           //get correct extension definition
           roleAttribute = (RoleAttribute) GlobalResourceLoader.getResourceLoader().getObject(new ObjectDefinition(
                   resp.getRoleAttributeName()));

           if (roleAttribute instanceof XmlConfiguredAttribute) {
               ExtensionDefinition roleAttributeDefinition = null;
               for (RuleTemplateAttribute ruleTemplateAttribute : rule.getRuleTemplate().getRuleTemplateAttributes()) {
                   if (resp.getRoleAttributeName().equals(ruleTemplateAttribute.getRuleAttribute().getResourceDescriptor())) {
                       roleAttributeDefinition = ruleTemplateAttribute.getRuleAttribute();
                       break;
                   }
               }
               ((XmlConfiguredAttribute)roleAttribute).setExtensionDefinition(roleAttributeDefinition);
           }
       }
	//setRuleAttribute(roleAttribute, rule, resp.getRoleAttributeName());
	List<String> qualifiedRoleNames = new ArrayList<String>();
	if (parentRequest != null && parentRequest.getQualifiedRoleName() != null) {
		qualifiedRoleNames.add(parentRequest.getQualifiedRoleName());
	} else {
        qualifiedRoleNames.addAll(roleAttribute.getQualifiedRoleNames(roleName, context.getDocumentContent()));
	}
       for (String qualifiedRoleName : qualifiedRoleNames) {
           if (parentRequest == null && isDuplicateActionRequestDetected(routeHeader, context.getNodeInstance(), resp, qualifiedRoleName)) {
               continue;
           }

           ResolvedQualifiedRole resolvedRole = roleAttribute.resolveQualifiedRole(context, roleName, qualifiedRoleName);
           RoleRecipient recipient = new RoleRecipient(roleName, qualifiedRoleName, resolvedRole);
           if (parentRequest == null) {
               ActionRequestValue roleRequest = arFactory.addRoleRequest(recipient, resp.getActionRequestedCd(),
                       resp.getApprovePolicy(), resp.getPriority(), resp.getResponsibilityId(), rule.isForceAction(),
                       rule.getDescription(), rule.getId());

               List<RuleDelegation> ruleDelegations = getRuleService().getRuleDelegationsByResponsibiltityId(resp.getResponsibilityId());
               if (ruleDelegations != null && !ruleDelegations.isEmpty()) {
                   // create delegations for all the children
                   for (ActionRequestValue request : roleRequest.getChildrenRequests()) {
                       for (RuleDelegation childRuleDelegation : ruleDelegations) {
                           buildDelegationGraph(arFactory, context, childRuleDelegation.getDelegationRule(), routeHeader, request, childRuleDelegation);
                       }
                   }
               }

           } else {
               arFactory.addDelegationRoleRequest(parentRequest, resp.getApprovePolicy(), recipient, resp.getResponsibilityId(), rule.isForceAction(), ruleDelegation.getDelegationType(), rule.getDescription(), rule.getId());
           }
       }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:61,代码来源:FlexRM.java

示例5: addRoleRequest

import org.kuali.rice.kew.user.RoleRecipient; //导入依赖的package包/类
/**
 * Creates a root Role Request
 * @param role
 * @param actionRequested
 * @param approvePolicy
 * @param priority
 * @param responsibilityId
 * @param forceAction
 * @param description
 * @param ruleId
 * @return the created root role request
 */
public ActionRequestValue addRoleRequest(RoleRecipient role, String actionRequested, String approvePolicy, Integer priority, String responsibilityId, Boolean forceAction, String description, String ruleId) {

	ActionRequestValue requestGraph = createActionRequest(actionRequested, priority, role, description, responsibilityId, forceAction, approvePolicy, ruleId, null);
	if (role != null && role.getResolvedQualifiedRole() != null && role.getResolvedQualifiedRole().getRecipients() != null) {
	    int legitimateTargets = 0;
        for (Iterator<Id> iter = role.getResolvedQualifiedRole().getRecipients().iterator(); iter.hasNext();) {
            Id recipientId = (Id) iter.next();
            if (recipientId.isEmpty())
            {
                throw new WorkflowRuntimeException("Failed to resolve id of type " + recipientId.getClass().getName() + " returned from role '" + role.getRoleName() + "'.  Id returned contained a null or empty value.");
            }
            if (recipientId instanceof UserId)
            {
                Principal principal = getIdentityHelperService().getPrincipal((UserId) recipientId);
                if(KRADUtils.isNotNull(principal)) {
                    role.setTarget(new KimPrincipalRecipient(principal));
                }
            } else if (recipientId instanceof GroupId)
            {
                role.setTarget(new KimGroupRecipient(getIdentityHelperService().getGroup((GroupId) recipientId)));
            } else
            {
                throw new WorkflowRuntimeException("Could not process the given type of id: " + recipientId.getClass());
            }
            if (role.getTarget() != null)
            {
                legitimateTargets++;
                ActionRequestValue request = createActionRequest(actionRequested, priority, role, description, responsibilityId, forceAction, null, ruleId, null);
                request.setParentActionRequest(requestGraph);
                requestGraph.getChildrenRequests().add(request);
            }
        }
	if (legitimateTargets == 0) {
        LOG.warn("Role did not yield any legitimate recipients");
    }
	} else {
		LOG.warn("Didn't create action requests for action request description '" + description + "' because of null role or null part of role object graph.");
	}
	requestGraphs.add(requestGraph);
	return requestGraph;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:54,代码来源:ActionRequestFactory.java

示例6: addRoleRequest

import org.kuali.rice.kew.user.RoleRecipient; //导入依赖的package包/类
/**
 * Creates a root Role Request
 * @param role
 * @param actionRequested
 * @param approvePolicy
 * @param priority
 * @param responsibilityId
 * @param forceAction
 * @param description
 * @param ruleId
 * @return the created root role request
 */
public ActionRequestValue addRoleRequest(RoleRecipient role, String actionRequested, String approvePolicy, Integer priority, String responsibilityId, Boolean forceAction, String description, String ruleId) {

	ActionRequestValue requestGraph = createActionRequest(actionRequested, priority, role, description, responsibilityId, forceAction, approvePolicy, ruleId, null);
	if (role != null && role.getResolvedQualifiedRole() != null && role.getResolvedQualifiedRole().getRecipients() != null) {
	    int legitimateTargets = 0;
        for (Iterator<Id> iter = role.getResolvedQualifiedRole().getRecipients().iterator(); iter.hasNext();) {
            Id recipientId = (Id) iter.next();
            if (recipientId.isEmpty())
            {
                throw new WorkflowRuntimeException("Failed to resolve id of type " + recipientId.getClass().getName() + " returned from role '" + role.getRoleName() + "'.  Id returned contained a null or empty value.");
            }
            if (recipientId instanceof UserId)
            {
                Principal principal = getIdentityHelperService().getPrincipal((UserId) recipientId);
                if(ObjectUtils.isNotNull(principal)) {
                    role.setTarget(new KimPrincipalRecipient(principal));
                }
            } else if (recipientId instanceof GroupId)
            {
                role.setTarget(new KimGroupRecipient(getIdentityHelperService().getGroup((GroupId) recipientId)));
            } else
            {
                throw new WorkflowRuntimeException("Could not process the given type of id: " + recipientId.getClass());
            }
            if (role.getTarget() != null)
            {
                legitimateTargets++;
                ActionRequestValue request = createActionRequest(actionRequested, priority, role, description, responsibilityId, forceAction, null, ruleId, null);
                request.setParentActionRequest(requestGraph);
                requestGraph.getChildrenRequests().add(request);
            }
        }
	if (legitimateTargets == 0) {
        LOG.warn("Role did not yield any legitimate recipients");
    }
	} else {
		LOG.warn("Didn't create action requests for action request description '" + description + "' because of null role or null part of role object graph.");
	}
	requestGraphs.add(requestGraph);
	return requestGraph;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:54,代码来源:ActionRequestFactory.java


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