本文整理汇总了Java中org.kuali.rice.kew.rule.RuleResponsibilityBo类的典型用法代码示例。如果您正苦于以下问题:Java RuleResponsibilityBo类的具体用法?Java RuleResponsibilityBo怎么用?Java RuleResponsibilityBo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RuleResponsibilityBo类属于org.kuali.rice.kew.rule包,在下文中一共展示了RuleResponsibilityBo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateRuleAndResponsibility
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入依赖的package包/类
public static void validateRuleAndResponsibility(RuleDelegationBo oldRuleDelegation, RuleDelegationBo newRuleDelegation, Map<String, String[]> parameters) {
String[] responsibilityIds = parameters.get(RESPONSIBILITY_ID_PARAM);
if (ArrayUtils.isEmpty(responsibilityIds)) {
throw new RiceRuntimeException("Delegation rule document must be initiated with a valid responsibility ID to delegate from.");
}
if (!ArrayUtils.isEmpty(responsibilityIds)) {
String responsibilityId = responsibilityIds[0];
RuleResponsibilityBo ruleResponsibility = KEWServiceLocator.getRuleService().findRuleResponsibility(responsibilityId);
if (ruleResponsibility == null) {
throw new RiceRuntimeException("Failed to locate a rule responsibility for responsibility ID " + responsibilityId);
}
oldRuleDelegation.setResponsibilityId(responsibilityId);
newRuleDelegation.setResponsibilityId(responsibilityId);
}
}
示例2: translateResponsibilitiesForLoad
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入依赖的package包/类
public static void translateResponsibilitiesForLoad(RuleBaseValues rule) {
for (RuleResponsibilityBo responsibility : rule.getRuleResponsibilities()) {
if (responsibility.getRuleResponsibilityType().equals(KewApiConstants.RULE_RESPONSIBILITY_WORKFLOW_ID)) {
PersonRuleResponsibility personResponsibility = new PersonRuleResponsibility();
copyResponsibility(responsibility, personResponsibility);
Principal principal = KEWServiceLocator.getIdentityHelperService().getPrincipal(personResponsibility.getRuleResponsibilityName());
personResponsibility.setPrincipalName(principal.getPrincipalName());
rule.getPersonResponsibilities().add(personResponsibility);
} else if (responsibility.getRuleResponsibilityType().equals(KewApiConstants.RULE_RESPONSIBILITY_GROUP_ID)) {
GroupRuleResponsibility groupResponsibility = new GroupRuleResponsibility();
copyResponsibility(responsibility, groupResponsibility);
Group group = KEWServiceLocator.getIdentityHelperService().getGroup(groupResponsibility.getRuleResponsibilityName());
groupResponsibility.setNamespaceCode(group.getNamespaceCode());
groupResponsibility.setName(group.getName());
rule.getGroupResponsibilities().add(groupResponsibility);
} else if (responsibility.getRuleResponsibilityType().equals(KewApiConstants.RULE_RESPONSIBILITY_ROLE_ID)) {
RoleRuleResponsibility roleResponsibility = new RoleRuleResponsibility();
copyResponsibility(responsibility, roleResponsibility);
rule.getRoleResponsibilities().add(roleResponsibility);
} else {
throw new RiceRuntimeException("Original responsibility with id '" + responsibility.getId() + "' contained a bad type code of '" + responsibility.getRuleResponsibilityType());
}
}
// since we've loaded the responsibilities, let's clear the originals so they don't get serialized to the maint doc XML
rule.getRuleResponsibilities().clear();
}
示例3: save
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入依赖的package包/类
@Override
public RuleBaseValues save(RuleBaseValues ruleBaseValues) {
if ( ruleBaseValues == null ) {
return null;
}
ruleBaseValues = getDataObjectService().save(ruleBaseValues);
if ( ruleBaseValues.getRoleResponsibilities() != null ) {
for ( RuleResponsibilityBo resp : ruleBaseValues.getRuleResponsibilities() ) {
resp.setRuleBaseValues(ruleBaseValues);
resp.setRuleBaseValuesId(ruleBaseValues.getId());
}
}
if ( ruleBaseValues.getRuleResponsibilities() != null && ruleBaseValues.getRuleResponsibilities().size() > 0 ) {
return getDataObjectService().save(ruleBaseValues);
} else {
return ruleBaseValues;
}
}
示例4: findRuleBaseValuesByResponsibilityReviewer
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入依赖的package包/类
@Override
public List<RuleBaseValues> findRuleBaseValuesByResponsibilityReviewer(String reviewerName, String type) {
org.kuali.rice.core.api.criteria.QueryByCriteria.Builder builder =
org.kuali.rice.core.api.criteria.QueryByCriteria.Builder.create();
builder.setPredicates(equal("ruleResponsibilityName",reviewerName),
equal("ruleResponsibilityType",type));
List responsibilities = getDataObjectService().findMatching(
RuleResponsibilityBo.class,builder.build()).getResults();
List rules = new ArrayList();
for (Iterator iter = responsibilities.iterator(); iter.hasNext();) {
RuleResponsibilityBo responsibility = (RuleResponsibilityBo) iter.next();
RuleBaseValues rule = responsibility.getRuleBaseValues();
if (rule != null && rule.getCurrentInd() != null && rule.getCurrentInd().booleanValue()) {
rules.add(rule);
}
}
return rules;
}
示例5: search
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入依赖的package包/类
@Override
public List<RuleBaseValues> search(String docTypeName, String ruleTemplateId, String ruleDescription, Collection<String> workgroupIds, String workflowId, Boolean delegateRule, Boolean activeInd, Map extensionValues, Collection actionRequestCodes) {
CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
CriteriaQuery<RuleBaseValues> cq = cb.createQuery(RuleBaseValues.class);
Root<RuleBaseValues> root = cq.from(RuleBaseValues.class);
List<javax.persistence.criteria.Predicate> predicates = getSearchCriteria(root,cq,docTypeName,
ruleTemplateId, ruleDescription, delegateRule, activeInd, extensionValues);
Subquery<RuleResponsibilityBo> subquery = addResponsibilityCriteria(cq,workgroupIds, workflowId, actionRequestCodes,
(workflowId != null), ((workgroupIds != null) && !workgroupIds.isEmpty()));
if (subquery != null){
predicates.add(cb.in(root.get("id")).value(subquery));
}
javax.persistence.criteria.Predicate[] preds = predicates.toArray(new javax.persistence.criteria.Predicate[predicates.size()]);
cq.where(preds);
TypedQuery<RuleBaseValues> q = getEntityManager().createQuery(cq);
return q.getResultList();
}
示例6: findResponsibilityIdForRule
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入依赖的package包/类
@Override
public String findResponsibilityIdForRule(String ruleName, String ruleResponsibilityName, String ruleResponsibilityType) {
org.kuali.rice.core.api.criteria.QueryByCriteria.Builder builder =
org.kuali.rice.core.api.criteria.QueryByCriteria.Builder.create();
builder.setPredicates(equal("ruleResponsibilityName",ruleResponsibilityName),
equal("ruleResponsibilityType",ruleResponsibilityType),
equal("ruleBaseValues.currentInd",Boolean.TRUE),
equal("ruleBaseValues.name",ruleName));
Collection responsibilities = getDataObjectService().findMatching(
RuleResponsibilityBo.class,builder.build()).getResults();
if (responsibilities != null) {
for (Iterator iter = responsibilities.iterator(); iter.hasNext();) {
RuleResponsibilityBo responsibility = (RuleResponsibilityBo) iter.next();
return responsibility.getResponsibilityId();
}
}
return null;
}
示例7: hookUpDelegateRuleToParentRule
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入依赖的package包/类
protected void hookUpDelegateRuleToParentRule(RuleBaseValues newParentRule, RuleBaseValues newDelegationRule, RuleDelegationBo existingRuleDelegation) {
// hook up parent rule to new rule delegation
boolean foundDelegation = false;
outer:for (RuleResponsibilityBo responsibility : newParentRule.getRuleResponsibilities()) {
for (RuleDelegationBo ruleDelegation : responsibility.getDelegationRules()) {
if (ruleDelegation.getDelegationRule().getId().equals(existingRuleDelegation.getDelegationRule().getId())) {
ruleDelegation.setDelegationRule(newDelegationRule);
foundDelegation = true;
break outer;
}
}
}
if (!foundDelegation) {
throw new WorkflowRuntimeException("Failed to locate the existing rule delegation with id: " + existingRuleDelegation.getDelegationRule().getId());
}
}
示例8: parseParentResponsibilityId
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入依赖的package包/类
private String parseParentResponsibilityId(Element element) throws XmlException {
String responsibilityId = element.getChildText(RESPONSIBILITY_ID, element.getNamespace());
if (!StringUtils.isBlank(responsibilityId)) {
return responsibilityId;
}
String parentRuleName = element.getChildText(PARENT_RULE_NAME, element.getNamespace());
if (StringUtils.isBlank(parentRuleName)) {
throw new XmlException("One of responsibilityId or parentRuleName needs to be defined");
}
RuleBaseValues parentRule = KEWServiceLocator.getRuleService().getRuleByName(parentRuleName);
if (parentRule == null) {
throw new XmlException("Could find the parent rule with name '" + parentRuleName + "'");
}
RuleResponsibilityBo ruleResponsibilityNameAndType = CommonXmlParser.parseResponsibilityNameAndType(element);
if (ruleResponsibilityNameAndType == null) {
throw new XmlException("Could not locate a valid responsibility declaration for the parent responsibility.");
}
String parentResponsibilityId = KEWServiceLocator.getRuleService().findResponsibilityIdForRule(parentRuleName,
ruleResponsibilityNameAndType.getRuleResponsibilityName(),
ruleResponsibilityNameAndType.getRuleResponsibilityType());
if (parentResponsibilityId == null) {
throw new XmlException("Failed to locate parent responsibility for rule with name '" + parentRuleName + "' and responsibility " + ruleResponsibilityNameAndType);
}
return parentResponsibilityId;
}
示例9: parseResponsibilities
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入依赖的package包/类
private List<RuleResponsibilityBo> parseResponsibilities(Element element, RuleBaseValues rule) throws XmlException {
if (element == null) {
return new ArrayList<RuleResponsibilityBo>(0);
}
List<RuleResponsibilityBo> existingResponsibilities = rule.getRuleResponsibilities();
List<RuleResponsibilityBo> responsibilities = new ArrayList<RuleResponsibilityBo>();
List<Element> responsibilityElements = (List<Element>)element.getChildren(RESPONSIBILITY, element.getNamespace());
for (Element responsibilityElement : responsibilityElements) {
RuleResponsibilityBo responsibility = parseResponsibility(responsibilityElement, rule);
reconcileWithExistingResponsibility(responsibility, existingResponsibilities);
responsibilities.add(responsibility);
}
if (responsibilities.size() == 0) {
throw new XmlException("Rule responsibility list must have at least one responsibility.");
}
return responsibilities;
}
示例10: reconcileWithExistingResponsibility
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入依赖的package包/类
/**
* Attempts to reconcile the given RuleResponsibility with the list of existing responsibilities (in the case of a
* rule being updated via the XML). This goal of this code is to copy responsibility ids from existing responsibilities
* to the new responsibility where appropriate. The code will attempt to find exact matches based on the values found
* on the responsibilities.
*/
private void reconcileWithExistingResponsibility(RuleResponsibilityBo responsibility, List<RuleResponsibilityBo> existingResponsibilities) {
if (existingResponsibilities == null || existingResponsibilities.isEmpty()) {
return;
}
RuleResponsibilityBo exactMatch = null;
for (RuleResponsibilityBo existingResponsibility : existingResponsibilities) {
if (isExactResponsibilityMatch(responsibility, existingResponsibility)) {
exactMatch = existingResponsibility;
break;
}
}
if (exactMatch != null) {
responsibility.setResponsibilityId(exactMatch.getResponsibilityId());
}
}
示例11: exportParentResponsibility
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入依赖的package包/类
private void exportParentResponsibility(Element parent, RuleDelegationBo delegation) {
Element parentResponsibilityElement = renderer.renderElement(parent, PARENT_RESPONSIBILITY);
RuleResponsibilityBo ruleResponsibility = KEWServiceLocator.getRuleService().findRuleResponsibility(delegation.getResponsibilityId());
renderer.renderTextElement(parentResponsibilityElement, PARENT_RULE_NAME, ruleResponsibility.getRuleBaseValues().getName());
if (ruleResponsibility.isUsingPrincipal()) {
Principal principal = ruleResponsibility.getPrincipal();
renderer.renderTextElement(parentResponsibilityElement, PRINCIPAL_NAME, principal.getPrincipalName());
} else if (ruleResponsibility.isUsingGroup()) {
Group group = ruleResponsibility.getGroup();
Element groupElement = renderer.renderElement(parentResponsibilityElement, GROUP_NAME);
groupElement.setText(group.getName());
groupElement.setAttribute(NAMESPACE, group.getNamespaceCode());
} else if (ruleResponsibility.isUsingRole()) {
renderer.renderTextElement(parentResponsibilityElement, ROLE, ruleResponsibility.getRuleResponsibilityName());
} else {
throw new RiceRuntimeException("Encountered a rule responsibility when exporting with an invalid type of '" + ruleResponsibility.getRuleResponsibilityType());
}
}
示例12: exportResponsibilities
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入依赖的package包/类
private void exportResponsibilities(Element parent, Collection<? extends RuleResponsibilityBo> responsibilities) {
if (responsibilities != null && !responsibilities.isEmpty()) {
Element responsibilitiesElement = renderer.renderElement(parent, RESPONSIBILITIES);
for (RuleResponsibilityBo ruleResponsibility : responsibilities) {
Element respElement = renderer.renderElement(responsibilitiesElement, RESPONSIBILITY);
//KULRICE-12282: commenting out the responsibility Id from the exported xml.
// renderer.renderTextElement(respElement, RESPONSIBILITY_ID, "" + ruleResponsibility.getResponsibilityId());
if (ruleResponsibility.isUsingPrincipal()) {
renderer.renderTextElement(respElement, PRINCIPAL_NAME, ruleResponsibility.getPrincipal().getPrincipalName());
} else if (ruleResponsibility.isUsingGroup()) {
Group group = ruleResponsibility.getGroup();
Element groupElement = renderer.renderTextElement(respElement, GROUP_NAME, group.getName());
groupElement.setAttribute(NAMESPACE, group.getNamespaceCode());
} else if (ruleResponsibility.isUsingRole()) {
renderer.renderTextElement(respElement, ROLE, ruleResponsibility.getRuleResponsibilityName());
renderer.renderTextElement(respElement, APPROVE_POLICY, ruleResponsibility.getApprovePolicy());
}
if (!StringUtils.isBlank(ruleResponsibility.getActionRequestedCd())) {
renderer.renderTextElement(respElement, ACTION_REQUESTED, ruleResponsibility.getActionRequestedCd());
}
if (ruleResponsibility.getPriority() != null) {
renderer.renderTextElement(respElement, PRIORITY, ruleResponsibility.getPriority().toString());
}
}
}
}
示例13: exportRuleDelegationParentResponsibility
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入依赖的package包/类
private void exportRuleDelegationParentResponsibility(Element parent, RuleDelegationBo delegation) {
Element parentResponsibilityElement = renderer.renderElement(parent, PARENT_RESPONSIBILITY);
RuleResponsibilityBo ruleResponsibility = KEWServiceLocator.getRuleService().findRuleResponsibility(delegation.getResponsibilityId());
renderer.renderTextElement(parentResponsibilityElement, PARENT_RULE_NAME, ruleResponsibility.getRuleBaseValues().getName());
if (ruleResponsibility.isUsingPrincipal()) {
Principal principal = ruleResponsibility.getPrincipal();
renderer.renderTextElement(parentResponsibilityElement, PRINCIPAL_NAME, principal.getPrincipalName());
} else if (ruleResponsibility.isUsingGroup()) {
Group group = ruleResponsibility.getGroup();
Element groupElement = renderer.renderElement(parentResponsibilityElement, GROUP_NAME);
groupElement.setText(group.getName());
groupElement.setAttribute(NAMESPACE, group.getNamespaceCode());
} else if (ruleResponsibility.isUsingRole()) {
renderer.renderTextElement(parentResponsibilityElement, ROLE, ruleResponsibility.getRuleResponsibilityName());
} else {
throw new RiceRuntimeException("Encountered a rule responsibility when exporting with an invalid type of '" + ruleResponsibility.getRuleResponsibilityType());
}
}
示例14: assertResponsibilities
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入依赖的package包/类
private void assertResponsibilities(List oldResps, List newResps) {
assertEquals(oldResps.size(), newResps.size());
for (Iterator iterator = oldResps.iterator(); iterator.hasNext();) {
RuleResponsibilityBo oldResp = (RuleResponsibilityBo) iterator.next();
boolean foundResp = false;
for (Iterator iterator2 = newResps.iterator(); iterator2.hasNext();) {
RuleResponsibilityBo newResp = (RuleResponsibilityBo) iterator2.next();
if (oldResp.getRuleResponsibilityName().equals(newResp.getRuleResponsibilityName())) {
assertEquals(oldResp.getActionRequestedCd(), newResp.getActionRequestedCd());
assertEquals(oldResp.getApprovePolicy(), newResp.getApprovePolicy());
assertEquals(oldResp.getResolvedRoleName(), newResp.getResolvedRoleName());
assertEquals(oldResp.getRole(), newResp.getRole());
assertEquals(oldResp.getRuleResponsibilityType(), newResp.getRuleResponsibilityType());
assertEquals(oldResp.getPriority(), newResp.getPriority());
foundResp = true;
break;
}
}
assertTrue("Could not locate responsibility "+oldResp.getRuleResponsibilityName()+" on rule "+oldResp.getRuleBaseValues().getDescription(), foundResp);
}
}
示例15: validateRuleAndResponsibility
import org.kuali.rice.kew.rule.RuleResponsibilityBo; //导入依赖的package包/类
public static void validateRuleAndResponsibility(RuleDelegationBo oldRuleDelegation, RuleDelegationBo newRuleDelegation, Map<String, String[]> parameters) {
String[] responsibilityIds = parameters.get(RESPONSIBILITY_ID_PARAM);
if (ArrayUtils.isEmpty(responsibilityIds)) {
throw new RiceRuntimeException("Delegation rule document must be initiated with a valid responsibility ID to delegate from.");
}
if (!ArrayUtils.isEmpty(responsibilityIds)) {
String responsibilityId = responsibilityIds[0];
RuleResponsibilityBo ruleResponsibility = KEWServiceLocator.getRuleService().findRuleResponsibility(responsibilityId);
if (ruleResponsibility == null) {
throw new RiceRuntimeException("Failed to locate a rule responsibility for responsibility ID " + responsibilityId);
}
oldRuleDelegation.setResponsibilityId(responsibilityId);
newRuleDelegation.setResponsibilityId(responsibilityId);
}
}