本文整理匯總了Java中org.kuali.rice.kew.api.rule.RuleResponsibility類的典型用法代碼示例。如果您正苦於以下問題:Java RuleResponsibility類的具體用法?Java RuleResponsibility怎麽用?Java RuleResponsibility使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RuleResponsibility類屬於org.kuali.rice.kew.api.rule包,在下文中一共展示了RuleResponsibility類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildDelegationGraph
import org.kuali.rice.kew.api.rule.RuleResponsibility; //導入依賴的package包/類
private void buildDelegationGraph(ActionRequestFactory arFactory, RouteContext context,
org.kuali.rice.kew.api.rule.Rule delegationRule, DocumentRouteHeaderValue routeHeaderValue, ActionRequestValue parentRequest, RuleDelegation ruleDelegation) {
context.setActionRequest(parentRequest);
RuleBaseValues delRuleBo = KEWServiceLocator.getRuleService().getRuleByName(delegationRule.getName());
if (delegationRule.isActive()) {
for (org.kuali.rice.kew.api.rule.RuleResponsibility delegationResp : delegationRule.getRuleResponsibilities())
{
if (delegationResp.isUsingRole())
{
makeRoleActionRequests(arFactory, context, delegationRule, delegationResp, routeHeaderValue, parentRequest, ruleDelegation);
} else if (delRuleBo.isMatch(context.getDocumentContent()))
{
makeActionRequest(arFactory, context, delegationRule, routeHeaderValue, delegationResp, parentRequest, ruleDelegation);
}
}
}
}
示例2: isDuplicateActionRequestDetected
import org.kuali.rice.kew.api.rule.RuleResponsibility; //導入依賴的package包/類
private boolean isDuplicateActionRequestDetected(DocumentRouteHeaderValue routeHeader, RouteNodeInstance nodeInstance, org.kuali.rice.kew.api.rule.RuleResponsibility resp, String qualifiedRoleName) {
List<ActionRequestValue> requests = getActionRequestService().findByStatusAndDocId(ActionRequestStatus.DONE.getCode(), routeHeader.getDocumentId());
for (ActionRequestValue request : requests)
{
if (((nodeInstance != null
&& request.getNodeInstance() != null
&& request.getNodeInstance().getRouteNodeInstanceId().equals(nodeInstance.getRouteNodeInstanceId())
) || request.getRouteLevel().equals(routeHeader.getDocRouteLevel())
)
&& request.getResponsibilityId().equals(resp.getResponsibilityId())
&& ObjectUtils.equals(request.getQualifiedRoleName(), qualifiedRoleName)) {
return true;
}
}
return false;
}
示例3: resolveResponsibilityId
import org.kuali.rice.kew.api.rule.RuleResponsibility; //導入依賴的package包/類
public ResponsibleParty resolveResponsibilityId(String responsibilityId) {
if (responsibilityId == null) {
throw new IllegalArgumentException("A null responsibilityId was passed to resolve responsibility!");
}
RuleResponsibility resp = getRuleService().getRuleResponsibility(responsibilityId);
ResponsibleParty responsibleParty = new ResponsibleParty();
if (resp!=null && resp.isUsingRole()) {
responsibleParty.setRoleName(resp.getResolvedRoleName());
} else if (resp!=null && resp.isUsingPrincipal()) {
responsibleParty.setPrincipalId(resp.getPrincipalId());
} else if (resp!=null && resp.isUsingGroup()) {
responsibleParty.setGroupId(resp.getGroupId());
} else {
throw new RiceRuntimeException("Failed to resolve responsibility from responsibility ID " + responsibilityId + ". Responsibility was an invalid type: " + resp);
}
return responsibleParty;
}
示例4: getDuplicateRuleId
import org.kuali.rice.kew.api.rule.RuleResponsibility; //導入依賴的package包/類
@Override
public String getDuplicateRuleId(RuleBaseValues rule) {
// TODO: this method is extremely slow, if we could implement a more optimized query here, that would help tremendously
Rule baseRule = RuleBaseValues.to(rule);
List<RuleResponsibility> responsibilities = baseRule.getRuleResponsibilities();
List<RuleExtension> extensions = baseRule.getRuleExtensions();
String docTypeName = baseRule.getDocTypeName();
String ruleTemplateName = baseRule.getRuleTemplateName();
//use api service to take advantage of caching
List<Rule> rules = KewApiServiceLocator.getRuleService().getRulesByTemplateNameAndDocumentTypeName(
ruleTemplateName, docTypeName);
for (Rule r : rules) {
if (ObjectUtils.equals(rule.isActive(), r.isActive()) &&
ObjectUtils.equals(docTypeName, r.getDocTypeName()) &&
ObjectUtils.equals(ruleTemplateName, r.getRuleTemplateName()) &&
CollectionUtils.collectionsEquivalent(responsibilities, r.getRuleResponsibilities()) &&
CollectionUtils.collectionsEquivalent(extensions, r.getRuleExtensions())) {
if (ObjectUtils.equals(baseRule.getRuleExpressionDef(), r.getRuleExpressionDef()) ||
(baseRule.getRuleExpressionDef() != null && r.getRuleExpressionDef() != null) &&
ObjectUtils.equals(baseRule.getRuleExpressionDef().getType(), r.getRuleExpressionDef().getType()) &&
ObjectUtils.equals(baseRule.getRuleExpressionDef().getExpression(), r.getRuleExpressionDef().getExpression())) {
// we have a duplicate
return r.getId();
}
}
}
return null;
}
示例5: getRuleResponsibility
import org.kuali.rice.kew.api.rule.RuleResponsibility; //導入依賴的package包/類
@Override
public RuleResponsibility getRuleResponsibility(String responsibilityId) {
incomingParamCheck("responsibilityId", responsibilityId);
QueryByCriteria.Builder builder = QueryByCriteria.Builder.create();
builder.setPredicates(equal("responsibilityId", responsibilityId));
QueryResults<RuleResponsibilityBo> results = dataObjectService.findMatching(RuleResponsibilityBo.class, builder.build());
if (results.getResults().isEmpty()) {
throw new RiceIllegalStateException("RuleResponsibility with specified id: " + responsibilityId + " does not exist");
}
if (results.getResults().size() > 1) {
throw new RiceIllegalStateException("Found more than one rule responsibility with responsibility id: " + responsibilityId);
}
return RuleResponsibilityBo.to(results.getResults().get(0));
}
示例6: getDuplicateRuleId
import org.kuali.rice.kew.api.rule.RuleResponsibility; //導入依賴的package包/類
public String getDuplicateRuleId(RuleBaseValues rule) {
// TODO: this method is extremely slow, if we could implement a more optimized query here, that would help tremendously
Rule baseRule = RuleBaseValues.to(rule);
List<RuleResponsibility> responsibilities = baseRule.getRuleResponsibilities();
List<RuleExtension> extensions = baseRule.getRuleExtensions();
String docTypeName = baseRule.getDocTypeName();
String ruleTemplateName = baseRule.getRuleTemplateName();
//use api service to take advantage of caching
List<Rule> rules = KewApiServiceLocator.getRuleService().getRulesByTemplateNameAndDocumentTypeName(
ruleTemplateName, docTypeName);
for (Rule r : rules) {
if (ObjectUtils.equals(rule.isActive(), r.isActive()) &&
ObjectUtils.equals(docTypeName, r.getDocTypeName()) &&
ObjectUtils.equals(ruleTemplateName, r.getRuleTemplateName()) &&
CollectionUtils.collectionsEquivalent(responsibilities, r.getRuleResponsibilities()) &&
CollectionUtils.collectionsEquivalent(extensions, r.getRuleExtensions())) {
if (ObjectUtils.equals(baseRule.getRuleExpressionDef(), r.getRuleExpressionDef()) ||
(baseRule.getRuleExpressionDef() != null && r.getRuleExpressionDef() != null) &&
ObjectUtils.equals(baseRule.getRuleExpressionDef().getType(), r.getRuleExpressionDef().getType()) &&
ObjectUtils.equals(baseRule.getRuleExpressionDef().getExpression(), r.getRuleExpressionDef().getExpression())) {
// we have a duplicate
return r.getId();
}
}
}
return null;
}
示例7: getRuleResponsibility
import org.kuali.rice.kew.api.rule.RuleResponsibility; //導入依賴的package包/類
@Override
public RuleResponsibility getRuleResponsibility(String responsibilityId) {
incomingParamCheck("responsibilityId", responsibilityId);
Map<String, String> criteria = Collections.singletonMap("responsibilityId", responsibilityId);
RuleResponsibilityBo responsibility = this.businessObjectService.findByPrimaryKey(RuleResponsibilityBo.class, criteria);
if (responsibility == null) {
throw new RiceIllegalStateException("RuleResponsibility with specified id: " + responsibilityId + " does not exist");
}
return RuleResponsibilityBo.to(responsibility);
}
示例8: makeActionRequests
import org.kuali.rice.kew.api.rule.RuleResponsibility; //導入依賴的package包/類
private void makeActionRequests(ActionRequestFactory arFactory, RouteContext context, org.kuali.rice.kew.api.rule.Rule rule, DocumentRouteHeaderValue routeHeader, ActionRequestValue parentRequest, RuleDelegation ruleDelegation)
throws WorkflowException {
List<org.kuali.rice.kew.api.rule.RuleResponsibility> responsibilities = rule.getRuleResponsibilities();
makeActionRequests(arFactory, responsibilities, context, rule, routeHeader, parentRequest, ruleDelegation);
}
示例9: makeRoleActionRequests
import org.kuali.rice.kew.api.rule.RuleResponsibility; //導入依賴的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());
}
}
}