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


Java RuleExtension类代码示例

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


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

示例1: isMatch

import org.kuali.rice.kew.api.rule.RuleExtension; //导入依赖的package包/类
public boolean isMatch(DocumentContent docContent) {
    for (RuleTemplateAttributeBo ruleTemplateAttribute : getRuleTemplate().getActiveRuleTemplateAttributes()) {
        if (!ruleTemplateAttribute.isWorkflowAttribute()) {
            continue;
        }
        WorkflowRuleAttribute routingAttribute = ruleTemplateAttribute.getWorkflowAttribute();

        RuleAttribute ruleAttribute = ruleTemplateAttribute.getRuleAttribute();
        if (ruleAttribute.getType().equals(KewApiConstants.RULE_XML_ATTRIBUTE_TYPE)) {
            ((GenericXMLRuleAttribute) routingAttribute).setExtensionDefinition(RuleAttribute.to(ruleAttribute));
        }
        String className = ruleAttribute.getResourceDescriptor();
        List<RuleExtension> editedRuleExtensions = new ArrayList<RuleExtension>();
        for (RuleExtensionBo extension : getRuleExtensions()) {
            if (extension.getRuleTemplateAttribute().getRuleAttribute().getResourceDescriptor().equals(className)) {
                editedRuleExtensions.add(RuleExtensionBo.to(extension));
            }
        }
        if (!routingAttribute.isMatch(docContent, editedRuleExtensions)) {
            return false;
        }
    }
    return true;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:RuleBaseValues.java

示例2: isMatch

import org.kuali.rice.kew.api.rule.RuleExtension; //导入依赖的package包/类
public boolean isMatch(DocumentContent docContent) {
    for (RuleTemplateAttributeBo ruleTemplateAttribute : getRuleTemplate().getActiveRuleTemplateAttributes()) {
        if (!ruleTemplateAttribute.isWorkflowAttribute()) {
            continue;
        }
        WorkflowRuleAttribute routingAttribute = (WorkflowRuleAttribute) ruleTemplateAttribute.getWorkflowAttribute();

        RuleAttribute ruleAttribute = ruleTemplateAttribute.getRuleAttribute();
        if (ruleAttribute.getType().equals(KewApiConstants.RULE_XML_ATTRIBUTE_TYPE)) {
            ((GenericXMLRuleAttribute) routingAttribute).setExtensionDefinition(RuleAttribute.to(ruleAttribute));
        }
        String className = ruleAttribute.getResourceDescriptor();
        List<RuleExtension> editedRuleExtensions = new ArrayList<RuleExtension>();
        for (RuleExtensionBo extension : getRuleExtensions()) {
            if (extension.getRuleTemplateAttribute().getRuleAttribute().getResourceDescriptor().equals(className)) {
                editedRuleExtensions.add(RuleExtensionBo.to(extension));
            }
        }
        if (!routingAttribute.isMatch(docContent, editedRuleExtensions)) {
            return false;
        }
    }
    return true;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:25,代码来源:RuleBaseValues.java

示例3: isMatch

import org.kuali.rice.kew.api.rule.RuleExtension; //导入依赖的package包/类
@Override
   public boolean isMatch(DocumentContent docContent, List<RuleExtension> ruleExtensions) {
setDoctypeName(getRuleDocumentTypeFromRuleExtensions(ruleExtensions));
       DocumentTypeService service = (DocumentTypeService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE);
       
	try {
		String docTypeName = getDocTypNameFromXML(docContent);
           if (docTypeName.equals(getDoctypeName())) {
               return true;
           }
           DocumentType documentType = service.findByName(docTypeName);
           while (documentType != null && documentType.getParentDocType() != null) {
               documentType = documentType.getParentDocType();
               if(documentType.getName().equals(getDoctypeName())){
                   return true;
               }
           }
	} catch (XPathExpressionException e) {
		throw new WorkflowRuntimeException(e);
	}
	
	
       if (ruleExtensions.isEmpty()) {
           return true;
       }
       return false;
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:RuleRoutingAttribute.java

示例4: getRuleDocumentTypeFromRuleExtensions

import org.kuali.rice.kew.api.rule.RuleExtension; //导入依赖的package包/类
protected String getRuleDocumentTypeFromRuleExtensions(List<RuleExtension> ruleExtensions) {
 for (RuleExtension extension : ruleExtensions) {
        if (extension.getRuleTemplateAttribute().getRuleAttribute().getResourceDescriptor().equals(getClass().getName())) {
            for (Map.Entry<String, String> extensionValue : extension.getExtensionValuesMap().entrySet()) {
                String key = extensionValue.getKey();
                String value = extensionValue.getValue();
                if (key.equals(DOC_TYPE_NAME_KEY)) {
                    return value;
                }
            }
        }
    }
 return null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:15,代码来源:RuleRoutingAttribute.java

示例5: isMatch

import org.kuali.rice.kew.api.rule.RuleExtension; //导入依赖的package包/类
public boolean isMatch(DocumentContent docContent, List<RuleExtension> ruleExtensions) {
    XPath xpath = null;
    String xPathCacheKey = null;
    RouteNodeInstance rni = docContent.getRouteContext().getNodeInstance();
    if (rni != null) {
        xPathCacheKey = "xPath" + rni.getRouteNodeInstanceId() + "-" + rni.getName();
        if(docContent.getRouteContext().getParameters().containsKey(xPathCacheKey)) {
            xpath = (XPath)docContent.getRouteContext().getParameters().get(xPathCacheKey);
        } else {
            xpath = XPathHelper.newXPath(docContent.getDocument());
            docContent.getRouteContext().getParameters().put(xPathCacheKey, xpath);
        }
    } else {
        xpath = XPathHelper.newXPath(docContent.getDocument());
        docContent.getRouteContext().getParameters().put(xPathCacheKey, xpath);
    }
    WorkflowFunctionResolver resolver = XPathHelper.extractFunctionResolver(xpath);
    resolver.setRuleExtensions(ruleExtensions);
    List<String> xPathExpressionsToEvaluate = extractExpressionsToEvaluate(xpath, docContent, ruleExtensions);
    for (String xPathExpressionToEvaluate : xPathExpressionsToEvaluate) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Evaluating xPath expression: " + xPathExpressionToEvaluate);
        }
        try {
            Boolean match = (Boolean) xpath.evaluate(xPathExpressionToEvaluate, docContent.getDocument(), XPathConstants.BOOLEAN);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Expression match result: " + match);
            }
            if (match != null && !match.booleanValue()) {
                return false;
            }
        } catch (XPathExpressionException e) {
            LOG.error("Error in isMatch ", e);
            throw new RuntimeException("Error trying to evalute xml content with xpath expression: " + xPathExpressionToEvaluate, e);
        }
    }
    return true;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:39,代码来源:StandardGenericXMLRuleAttribute.java

示例6: to

import org.kuali.rice.kew.api.rule.RuleExtension; //导入依赖的package包/类
/**
 * Converts a mutable bo to its immutable counterpart
 * @param bo the mutable business object
 * @return the immutable object
 */
public static RuleExtension to(RuleExtensionBo bo) {
    if (bo == null) {
        return null;
    }
    return RuleExtension.Builder.create(bo).build();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:12,代码来源:RuleExtensionBo.java

示例7: isMatch

import org.kuali.rice.kew.api.rule.RuleExtension; //导入依赖的package包/类
public boolean isMatch(DocumentContent docContent, List<RuleExtension> ruleExtensions) {
    log.info("isMatch: " + docContent + " " + ruleExtensions);
    try {
        // could be multiple attributes on the incoming doc content!
        List<Map<String, String>> propertiesList = content.parseContent(docContent.getAttributeContent());
        
        return isMatch(propertiesList, ruleExtensions);
    } catch (XPathExpressionException xpee) {
        String message = "Error parsing attribute '" + attributeName + "' content: " + docContent.getDocContent();
        log.error(message, xpee);
        throw new RuntimeException(xpee);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:14,代码来源:GenericWorkflowAttribute.java

示例8: getDuplicateRuleId

import org.kuali.rice.kew.api.rule.RuleExtension; //导入依赖的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;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:31,代码来源:RuleServiceInternalImpl.java

示例9: isMatch

import org.kuali.rice.kew.api.rule.RuleExtension; //导入依赖的package包/类
public boolean isMatch(DocumentContent docContent, List<RuleExtension> ruleExtensions) {
    // FIXME: ok, this MUST return true, as it IS evaluated (don't know why)
    // maybe investigate only calling isMatch on rule attributes as it doesn't seem that
    // matching is relevant for role attributes...is it?
    // throw new UnsupportedOperationException("Role attributes do not implement isMatch");
    return true;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:8,代码来源:GenericRoleAttribute.java

示例10: getDuplicateRuleId

import org.kuali.rice.kew.api.rule.RuleExtension; //导入依赖的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;
    }
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:30,代码来源:RuleServiceInternalImpl.java

示例11: isMatch

import org.kuali.rice.kew.api.rule.RuleExtension; //导入依赖的package包/类
public boolean isMatch(DocumentContent docContent, List<RuleExtension> ruleExtensions) {
    //throw new UnsupportedOperationException("Role attributes do not implement isMatch");
    return true;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:5,代码来源:AbstractRoleAttribute.java

示例12: getRuleExtensions

import org.kuali.rice.kew.api.rule.RuleExtension; //导入依赖的package包/类
public List<RuleExtension> getRuleExtensions() {
    return this.ruleExtensions;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:4,代码来源:WorkflowFunctionResolver.java

示例13: setRuleExtensions

import org.kuali.rice.kew.api.rule.RuleExtension; //导入依赖的package包/类
public void setRuleExtensions(List<RuleExtension> ruleExtensions) {
    this.ruleExtensions = ruleExtensions;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:4,代码来源:WorkflowFunctionResolver.java

示例14: isMatch

import org.kuali.rice.kew.api.rule.RuleExtension; //导入依赖的package包/类
public boolean isMatch(org.kuali.rice.kew.api.rule.Rule ruleDefinition, DocumentContent docContent) {
    if (ruleDefinition.getRuleTemplate() == null) {
        // this can happen if neither rule template nor expression was specified in the rule definition
        // because WorkflowAttributeRuleExpression is the default expression implementation, we should
        // handle this here in order to support rules that fire unconditionally (and just return a statically
        // configured list of responsibilities)
        // the alternative is to either detect this situation in the rule xml parser or RuleImpl, and either substitute
        // a different RuleExpression implementation (a "default default" one) in the configuration, or at runtime,
        // that simply implements the one-liner of returning responsibilities.
        // doing this in the existing WorkflowAttributeRuleExpression implementation introduces the least change
        // or compatibilities issues, and avoids pushing compensating logic into RuleImpl
        return true;
    }
    //RuleBaseValues rule = KEWServiceLocator.getRuleService().getRuleByName(ruleDefinition.getName());
    for (RuleTemplateAttribute ruleTemplateAttribute : ruleDefinition.getRuleTemplate().getActiveRuleTemplateAttributes()) {
        String attributeName = ruleTemplateAttribute.getRuleAttribute().getName();
        if (!RuleAttribute.isWorkflowAttribute(ruleTemplateAttribute.getRuleAttribute().getType())) {
            continue;
        }
        //WorkflowRuleAttribute routingAttribute = (WorkflowRuleAttribute) ruleTemplateAttribute.getWorkflowAttribute();
        ExtensionDefinition extensionDefinition = KewApiServiceLocator.getExtensionRepositoryService().getExtensionByName(attributeName);
        Object attribute = ExtensionUtils.loadExtension(extensionDefinition);
        if (attribute == null) {
            throw new RiceIllegalArgumentException("Failed to load WorkflowRuleAttribute for: " + extensionDefinition);
        }
        if (!WorkflowRuleAttribute.class.isAssignableFrom(attribute.getClass())) {
            throw new RiceIllegalArgumentException("Failed to locate a WorkflowRuleAttribute with the given name: " + attributeName);
        }
        if (attribute instanceof XmlConfiguredAttribute) {
            ((XmlConfiguredAttribute)attribute).setExtensionDefinition(extensionDefinition);
        }

        WorkflowRuleAttribute routingAttribute = (WorkflowRuleAttribute)attribute;

       ExtensionDefinition ruleAttribute = ruleTemplateAttribute.getRuleAttribute();
        if (ruleAttribute.getType().equals(KewApiConstants.RULE_XML_ATTRIBUTE_TYPE)) {
            ((GenericXMLRuleAttribute) routingAttribute).setExtensionDefinition(ruleAttribute);
        }
        String className = ruleAttribute.getResourceDescriptor();
        List<RuleExtension> editedRuleExtensions = new ArrayList();
        for (RuleExtension extension : ruleDefinition.getRuleExtensions()) {
            if (extension.getRuleTemplateAttribute().getRuleAttribute().getResourceDescriptor().equals(className)) {
                editedRuleExtensions.add(extension);
            }
        }
        if (!routingAttribute.isMatch(docContent, editedRuleExtensions)) {
            return false;
        }
    }
    return true;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:52,代码来源:WorkflowAttributeRuleExpression.java

示例15: isMatch

import org.kuali.rice.kew.api.rule.RuleExtension; //导入依赖的package包/类
/**
 * @see org.kuali.rice.kew.rule.GenericRoleAttribute#isMatch(org.kuali.rice.kew.routeheader.DocumentContent, java.util.List)
 */
@Override
public boolean isMatch(DocumentContent docContent, List<RuleExtension> ruleExtensions) {
    LOG.info("CHANNEL REVIEWER ROLE ATTRIBUTE IS MATCH");
    return super.isMatch(docContent, ruleExtensions);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:9,代码来源:ChannelReviewerRoleAttribute.java


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