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


Java UserId類代碼示例

本文整理匯總了Java中org.kuali.rice.kew.api.user.UserId的典型用法代碼示例。如果您正苦於以下問題:Java UserId類的具體用法?Java UserId怎麽用?Java UserId使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UserId類屬於org.kuali.rice.kew.api.user包,在下文中一共展示了UserId類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPrincipal

import org.kuali.rice.kew.api.user.UserId; //導入依賴的package包/類
public Principal getPrincipal(UserId userId) {
	if (userId == null) {
		return null;
	} else if (userId instanceof PrincipalId) {
		String principalId = ((PrincipalId)userId).getPrincipalId();
		return KimApiServiceLocator.getIdentityService().getPrincipal(principalId);
	} else if (userId instanceof PrincipalName) {
		String principalName = ((PrincipalName)userId).getId();
		return KimApiServiceLocator.getIdentityService().getPrincipalByPrincipalName(principalName);
	} else if (userId instanceof EmployeeId) {
		String employeeId = ((EmployeeId)userId).getEmployeeId();
		Person person = getPersonByEmployeeId(employeeId);
		return getPrincipal(person.getPrincipalId());
	}
	throw new RiceIllegalArgumentException("Invalid UserIdDTO type was passed: " + userId);
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:17,代碼來源:IdentityHelperServiceImpl.java

示例2: addDelegationRoleRequest

import org.kuali.rice.kew.api.user.UserId; //導入依賴的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: addRoleRequest

import org.kuali.rice.kew.api.user.UserId; //導入依賴的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

示例4: addRoleRequest

import org.kuali.rice.kew.api.user.UserId; //導入依賴的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

示例5: getPrincipal

import org.kuali.rice.kew.api.user.UserId; //導入依賴的package包/類
/**
 * Returns the principal for the given UserId.
 * 
 * @throws RiceIllegalArgumentException if the given UserId does not resolve to a valid principal
 */
public Principal getPrincipal(UserId userId);
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:7,代碼來源:IdentityHelperService.java


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