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


Java RuleAttribute.isWorkflowAttribute方法代码示例

本文整理汇总了Java中org.kuali.rice.kew.rule.bo.RuleAttribute.isWorkflowAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java RuleAttribute.isWorkflowAttribute方法的具体用法?Java RuleAttribute.isWorkflowAttribute怎么用?Java RuleAttribute.isWorkflowAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.kew.rule.bo.RuleAttribute的用法示例。


在下文中一共展示了RuleAttribute.isWorkflowAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setRuleAttributeErrors

import org.kuali.rice.kew.rule.bo.RuleAttribute; //导入方法依赖的package包/类
protected boolean setRuleAttributeErrors(RuleBaseValues rule){

		boolean isValid = true;

		RuleTemplate ruleTemplate = KewApiServiceLocator.getRuleService().getRuleTemplate(rule.getRuleTemplateId());

		/** Populate rule extension values * */
		for (RuleTemplateAttribute ruleTemplateAttribute : ruleTemplate.getActiveRuleTemplateAttributes()) {
            if (!RuleAttribute.isWorkflowAttribute(ruleTemplateAttribute.getRuleAttribute().getType())) {
                continue;
            }
            Map<String, String> parameterMap = WebRuleUtils.getFieldMapForRuleTemplateAttribute(rule, ruleTemplateAttribute);
            WorkflowRuleAttributeRows rows =
                    KEWServiceLocator.getWorkflowRuleAttributeMediator().getRuleRows(parameterMap, ruleTemplateAttribute);

			// TODO hook validation of rule data into PreRules
            List<RemotableAttributeError> errors = rows.getValidationErrors();
			if (!errors.isEmpty()) {
                isValid = false;
				for(RemotableAttributeError error: errors){
				    this.putFieldError("RuleAttributes", RiceKeyConstants.ERROR_CUSTOM, error.getMessage());
				}
			}
		}
		return isValid;

	}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:RoutingRuleMaintainableBusRule.java

示例2: selectRules

import org.kuali.rice.kew.rule.bo.RuleAttribute; //导入方法依赖的package包/类
public List<Rule> selectRules(RouteContext context, DocumentRouteHeaderValue routeHeader, RouteNodeInstance nodeInstance, String selectionCriterion, Timestamp effectiveDate) {
    // for TemplateRuleSelector, the criterion is taken as a ruletemplate name
    final String ruleTemplateName = selectionCriterion;

    Set<MassRuleAttribute> massRules = new HashSet<MassRuleAttribute>();
    RuleTemplate template = KewApiServiceLocator.getRuleService().getRuleTemplateByName(ruleTemplateName);
    if (template == null) {
        throw new WorkflowRuntimeException("Could not locate the rule template with name " + ruleTemplateName + " on document " + routeHeader.getDocumentId());
    }
    for (RuleTemplateAttribute templateAttribute : template.getActiveRuleTemplateAttributes()) {
        String ruleAttributeName = templateAttribute.getRuleAttribute().getName();
        if (!RuleAttribute.isWorkflowAttribute(templateAttribute.getRuleAttribute().getType())) {
            continue;
        }
        ExtensionDefinition extensionDefinition = KewApiServiceLocator.getExtensionRepositoryService().getExtensionByName(ruleAttributeName);
        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: " + ruleAttributeName);
        }
        if (attribute instanceof XmlConfiguredAttribute) {
            ((XmlConfiguredAttribute)attribute).setExtensionDefinition(extensionDefinition);
        }

        WorkflowRuleAttribute ruleAttribute = (WorkflowRuleAttribute)attribute;
        if (ruleAttribute instanceof MassRuleAttribute) {
            massRules.add((MassRuleAttribute) attribute);
        }

    }

    List<org.kuali.rice.kew.api.rule.Rule> rules;
    if (effectiveDate == null) {
        rules = KewApiServiceLocator.getRuleService()
                .getRulesByTemplateNameAndDocumentTypeName(ruleTemplateName,
                        routeHeader.getDocumentType().getName());
    } else {
        rules = KewApiServiceLocator.getRuleService()
                .getRulesByTemplateNameAndDocumentTypeNameAndEffectiveDate(ruleTemplateName,
                        routeHeader.getDocumentType().getName(), new DateTime(effectiveDate.getTime()));
    }
    numberOfSelectedRules = rules.size();

    // TODO really the route context just needs to be able to support nested create and clears
    // (i.e. a Stack model similar to transaction intercepting in Spring) and we wouldn't have to do this
    if (context.getDocument() == null) {
        context.setDocument(routeHeader);
    }
    if (context.getNodeInstance() == null) {
        context.setNodeInstance(nodeInstance);
    }
    DocumentContent documentContent = context.getDocumentContent();
    PerformanceLogger performanceLogger = new PerformanceLogger();
    // have all mass rule attributes filter the list of non applicable rules
    for (MassRuleAttribute massRuleAttribute : massRules) {
        rules = massRuleAttribute.filterNonMatchingRules(context, rules);
    }
    performanceLogger.log("Time to filter massRules for template " + template.getName());

    List<Rule> ruleList = new ArrayList<Rule>(rules.size());
    for (org.kuali.rice.kew.api.rule.Rule ruleDefinition: rules) {
        ruleList.add(new RuleImpl(ruleDefinition));
    }
    return ruleList;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:68,代码来源:TemplateRuleSelector.java

示例3: isMatch

import org.kuali.rice.kew.rule.bo.RuleAttribute; //导入方法依赖的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


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