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


Java RuleTemplateAttributeBo类代码示例

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


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

示例1: getRuleTemplateRows

import org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo; //导入依赖的package包/类
public static List<Row> getRuleTemplateRows(RuleBaseValues rule, boolean delegateRule) {
	List<Row> rows = new ArrayList<Row>();
	RuleTemplateBo ruleTemplate = rule.getRuleTemplate();
	Map<String, String> fieldNameMap = new HashMap<String, String>();
	// refetch rule template from service because after persistence in KNS, it comes back without any rule template attributes
	if (ruleTemplate != null && ruleTemplate.getId() != null) {
		ruleTemplate = KEWServiceLocator.getRuleTemplateService().findByRuleTemplateId(ruleTemplate.getId());
		if (ruleTemplate != null) {
			List<RuleTemplateAttributeBo> ruleTemplateAttributes = ruleTemplate.getActiveRuleTemplateAttributes();
			Collections.sort(ruleTemplateAttributes);
			for (RuleTemplateAttributeBo ruleTemplateAttribute : ruleTemplateAttributes) {
				if (!ruleTemplateAttribute.isWorkflowAttribute()) {
					continue;
				}
                Map<String, String> parameters = getFieldMapForRuleTemplateAttribute(rule, ruleTemplateAttribute);
                WorkflowRuleAttributeRows workflowRuleAttributeRows =
                        KEWServiceLocator.getWorkflowRuleAttributeMediator().getRuleRows(parameters, ruleTemplateAttribute);
                List<Row> attributeRows = transformAndPopulateAttributeRows(workflowRuleAttributeRows.getRows(),
                        ruleTemplateAttribute, rule, fieldNameMap, delegateRule);
                rows.addAll(attributeRows);
			}
		}
		transformFieldConversions(rows, fieldNameMap);
	}
	return rows;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:27,代码来源:WebRuleUtils.java

示例2: transformAndPopulateAttributeRows

import org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo; //导入依赖的package包/类
/**
 * Processes the Fields on the various attributes Rows to assign an appropriate field name to them so that the
 * field name rendered in the maintenance HTML will properly assign the value to RuleBaseValues.fieldValues.
 */

public static List<Row> transformAndPopulateAttributeRows(List<Row> attributeRows, RuleTemplateAttributeBo ruleTemplateAttribute, RuleBaseValues rule, Map<String, String> fieldNameMap, boolean delegateRule) {

	for (Row row : attributeRows) {
		for (Field field : row.getFields()) {
			String fieldName = field.getPropertyName();
			if (!StringUtils.isBlank(fieldName)) {
				String valueKey = ruleTemplateAttribute.getId() + ID_SEPARATOR + fieldName;

				String propertyName;

				if (delegateRule) {
                       propertyName = "delegationRule.fieldValues(" + valueKey + ")";
                   } else {
					propertyName = "fieldValues(" + valueKey + ")";
				}

				fieldNameMap.put(fieldName, propertyName);
				field.setPropertyName(propertyName);
				field.setPropertyValue(rule.getFieldValues().get(valueKey));
			}
		}
	}
	return attributeRows;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:30,代码来源:WebRuleUtils.java

示例3: loadFields

import org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo; //导入依赖的package包/类
private void loadFields() {
	fields.clear();
	if (getRuleTemplateId() != null) {
		RuleTemplateBo ruleTemplate = getRuleTemplateService().findByRuleTemplateId(getRuleTemplateId());
		if (ruleTemplate != null) {
			List ruleTemplateAttributes = ruleTemplate.getActiveRuleTemplateAttributes();
			Collections.sort(ruleTemplateAttributes);
			for (Iterator iter = ruleTemplateAttributes.iterator(); iter.hasNext();) {
				RuleTemplateAttributeBo ruleTemplateAttribute = (RuleTemplateAttributeBo) iter.next();
				if (!ruleTemplateAttribute.isWorkflowAttribute()) {
					continue;
				}
                WorkflowRuleAttributeRows workflowRuleAttributeRows =
                        KEWServiceLocator.getWorkflowRuleAttributeMediator().getRuleRows(null, ruleTemplateAttribute);
				for (Row row : workflowRuleAttributeRows.getRows()) {
					for (Field field : row.getFields()) {
                           String fieldValue = "";
                           RuleExtensionValue extensionValue = getRuleExtensionValue(ruleTemplateAttribute.getId(), field.getPropertyName());
                           fieldValue = (extensionValue != null) ? extensionValue.getValue() : field.getPropertyValue();
                           fields.add(new KeyValueId(field.getPropertyName(), fieldValue, ruleTemplateAttribute.getId()));
                       }
				}
			}
		}
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:27,代码来源:WebRuleBaseValues.java

示例4: loadRows

import org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo; //导入依赖的package包/类
private void loadRows() {
	getRoles().clear();
	if (getRuleTemplateId() != null) {
		RuleTemplateBo ruleTemplate = getRuleTemplateService().findByRuleTemplateId(getRuleTemplateId());
		if (ruleTemplate != null) {
			setRuleTemplateName(ruleTemplate.getName());
			List<RuleTemplateAttributeBo> ruleTemplateAttributes = ruleTemplate.getActiveRuleTemplateAttributes();
			Collections.sort(ruleTemplateAttributes);
			List<Row> rows = new ArrayList<Row>();
			for (RuleTemplateAttributeBo ruleTemplateAttribute : ruleTemplateAttributes) {
				if (!ruleTemplateAttribute.isWorkflowAttribute()) {
					continue;
				}
                WorkflowRuleAttributeRows workflowRuleAttributeRows =
                        KEWServiceLocator.getWorkflowRuleAttributeMediator().getRuleRows(getFieldMap(ruleTemplateAttribute.getId()), ruleTemplateAttribute);
                rows.addAll(workflowRuleAttributeRows.getRows());
                getRoles().addAll(KEWServiceLocator.getWorkflowRuleAttributeMediator().getRoleNames(ruleTemplateAttribute));
			}
			setRows(rows);
		}
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:23,代码来源:WebRuleBaseValues.java

示例5: isMatch

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

示例6: fixAssociations

import org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo; //导入依赖的package包/类
/**
 * Ensures that dependent objects have a reference to the specified rule template
 * @param ruleTemplate the rule template whose associates to check
 */
private void fixAssociations(RuleTemplateBo ruleTemplate) {
    // if it's a valid rule template instance
    if (ruleTemplate != null && ruleTemplate.getId() != null) {
        // for every rule template attribute
        for (RuleTemplateAttributeBo ruleTemplateAttribute: ruleTemplate.getRuleTemplateAttributes()) {
            // if the rule template is not set on the attribute, set it
            if (ruleTemplateAttribute.getRuleTemplate() == null || ruleTemplateAttribute.getRuleTemplateId() == null) {
                ruleTemplateAttribute.setRuleTemplate(ruleTemplate);
            }
            // if the rule attribute is set, load up the rule attribute and set the BO on the ruletemplateattribute association object
            if (ruleTemplateAttribute.getRuleAttribute() == null) {
                RuleAttributeService ruleAttributeService = (RuleAttributeService) KEWServiceLocator.getService(KEWServiceLocator.RULE_ATTRIBUTE_SERVICE);
                ruleTemplateAttribute.setRuleAttribute(ruleAttributeService.findByRuleAttributeId(ruleTemplateAttribute.getRuleAttributeId()));
            }
        }
        // for every rule template option
        for (RuleTemplateOptionBo option: ruleTemplate.getRuleTemplateOptions()) {
            // if the rule template is not set on the option, set it
            if (option.getRuleTemplate() == null || option.getRuleTemplateId() == null) {
                option.setRuleTemplate(ruleTemplate);
            }
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:RuleTemplateServiceImpl.java

示例7: testIsWorkflowAttribute

import org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo; //导入依赖的package包/类
@Test
public void testIsWorkflowAttribute() throws Exception {
    RuleTemplateBo template = KEWServiceLocator.getRuleTemplateService().findByRuleTemplateName("TemplateWithRuleValidationAttribute");
    List<RuleTemplateAttributeBo> ruleTemplateAttributes = (List<RuleTemplateAttributeBo>) template.getRuleTemplateAttributes();
    int index = 0;
    for (RuleTemplateAttributeBo ruleTemplateAttribute : ruleTemplateAttributes) {
        boolean isWorkflowAttribute = ruleTemplateAttribute.isWorkflowAttribute();
        Object attribute = ruleTemplateAttribute.getAttribute();
        attribute = ClassLoaderUtils.unwrapFromProxy(attribute);
        if (index == 0) {
            // should be the TestRuleAttribute
            assertNotNull(attribute);
            assertEquals("Should be TestRuleAttribute", TestRuleAttribute.class, attribute.getClass());
            assertTrue("TestRuleAttribute is a workflow attribute.", isWorkflowAttribute);
        } else if (index == 1) {
            // should be the TestRuleValidationAttribute so should be null
            assertEquals("Should be TestRuleValidationAttribute", TestRuleValidationAttribute.class,
                    attribute.getClass());
            assertFalse("TestRuleValidationAttribute is not a workflow attribute", isWorkflowAttribute);
        }
        index++;
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:RuleTemplateAttributeTest.java

示例8: testListOfTemplateAttributes

import org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo; //导入依赖的package包/类
private void testListOfTemplateAttributes(List ruleTemplateAttributes, String[] activeRuleTemplateAttributeNames, String[] requiredRuleTemplateAttributeNames) {
    for (Iterator iterator = ruleTemplateAttributes.iterator(); iterator.hasNext();) {
        RuleTemplateAttributeBo templateAttribute = (RuleTemplateAttributeBo) iterator.next();
        String ruleAttributeName = templateAttribute.getRuleAttribute().getName();
        
        LOG.info("Attribute name '" + ruleAttributeName +"' active indicator is " + templateAttribute.isActive());
        if (activeRuleTemplateAttributeNames == null) {
            assertEquals("Active indicator should be false for all attributes but is not for attribute '" + ruleAttributeName + "'",Boolean.FALSE, templateAttribute.getActive());
        } else {
            runTestsOnTemplateAttributeField(ruleAttributeName, templateAttribute.isActive(), activeRuleTemplateAttributeNames, "active");
        }

        LOG.info("Attribute name '" + ruleAttributeName +"' required indicator is " + templateAttribute.isRequired());
        if (requiredRuleTemplateAttributeNames == null) {
            assertEquals("Required indicator should be false for all attributes but is not for attribute '" + ruleAttributeName + "'",Boolean.FALSE, templateAttribute.getRequired());
        } else {
            runTestsOnTemplateAttributeField(ruleAttributeName, templateAttribute.isRequired(), requiredRuleTemplateAttributeNames, "required");
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:RuleTemplateXmlParserTest.java

示例9: testAllAttributesActive

import org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo; //导入依赖的package包/类
private void testAllAttributesActive(List activeRuleTemplateAttributes, String[] activeRuleTemplateAttributeNames) {
    for (Iterator iterator = activeRuleTemplateAttributes.iterator(); iterator.hasNext();) {
        RuleTemplateAttributeBo activeTemplateAttribute = (RuleTemplateAttributeBo) iterator.next();
        String ruleAttributeName = activeTemplateAttribute.getRuleAttribute().getName();
        assertEquals("Template Attribute with name '" + ruleAttributeName + "' has invalid active value", Boolean.TRUE, activeTemplateAttribute.getActive());
        boolean foundAttribute = false;
        for (int i = 0; i < activeRuleTemplateAttributeNames.length; i++) {
            String shouldBeActiveAttributeName = activeRuleTemplateAttributeNames[i];
            if (shouldBeActiveAttributeName.equals(ruleAttributeName)) {
                foundAttribute = true;
                break;
            }
        }
        if (!foundAttribute) {
            fail("Template Attribute with name '" + ruleAttributeName + "' should have been in active template name list but was not found");
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:RuleTemplateXmlParserTest.java

示例10: getRuleTemplateRows

import org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo; //导入依赖的package包/类
public static List<Row> getRuleTemplateRows(RuleBaseValues rule, boolean delegateRule) {
	List<Row> rows = new ArrayList<Row>();
	RuleTemplateBo ruleTemplate = rule.getRuleTemplate();
	Map<String, String> fieldNameMap = new HashMap<String, String>();
	// refetch rule template from service because after persistence in KNS, it comes back without any rule template attributes
	if (ruleTemplate != null) {
		ruleTemplate = KEWServiceLocator.getRuleTemplateService().findByRuleTemplateId(ruleTemplate.getId());
		if (ruleTemplate != null) {
			List<RuleTemplateAttributeBo> ruleTemplateAttributes = ruleTemplate.getActiveRuleTemplateAttributes();
			Collections.sort(ruleTemplateAttributes);
			for (RuleTemplateAttributeBo ruleTemplateAttribute : ruleTemplateAttributes) {
				if (!ruleTemplateAttribute.isWorkflowAttribute()) {
					continue;
				}
                Map<String, String> parameters = getFieldMapForRuleTemplateAttribute(rule, ruleTemplateAttribute);
                WorkflowRuleAttributeRows workflowRuleAttributeRows =
                        KEWServiceLocator.getWorkflowRuleAttributeMediator().getRuleRows(parameters, ruleTemplateAttribute);
                List<Row> attributeRows = transformAndPopulateAttributeRows(workflowRuleAttributeRows.getRows(),
                        ruleTemplateAttribute, rule, fieldNameMap, delegateRule);
                rows.addAll(attributeRows);
			}
		}
		transformFieldConversions(rows, fieldNameMap);
	}
	return rows;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:27,代码来源:WebRuleUtils.java

示例11: isMatch

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

示例12: testIsWorkflowAttribute

import org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo; //导入依赖的package包/类
@Test
public void testIsWorkflowAttribute() throws Exception {
    RuleTemplateBo template = KEWServiceLocator.getRuleTemplateService().findByRuleTemplateName("TemplateWithRuleValidationAttribute");
    List<RuleTemplateAttributeBo> ruleTemplateAttributes = (List<RuleTemplateAttributeBo>) template.getRuleTemplateAttributes();
    int index = 0;
    for (RuleTemplateAttributeBo ruleTemplateAttribute : ruleTemplateAttributes) {
        boolean isWorkflowAttribute = ruleTemplateAttribute.isWorkflowAttribute();
        Object attribute = ruleTemplateAttribute.getAttribute();
        attribute = ClassLoaderUtils.unwrapFromProxy(attribute);
        if (index == 0) {
            // should be the TestRuleAttribute
            assertNotNull(attribute);
            assertEquals("Should be TestRuleAttribute", TestRuleAttribute.class, attribute.getClass());
            assertTrue("TestRuleAttribute is a workflow attribute.", isWorkflowAttribute);
        } else if (index == 1) {
            // should be the TestRuleValidationAttribute so should be null
            assertEquals("Should be TestRuleValidationAttribute", TestRuleValidationAttribute.class, attribute.getClass());
            assertFalse("TestRuleValidationAttribute is not a workflow attribute", isWorkflowAttribute);
        }
        index++;
    }
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:23,代码来源:RuleTemplateAttributeTest.java

示例13: templateHasRole

import org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo; //导入依赖的package包/类
private boolean templateHasRole(RuleTemplateBo template, String roleName) {
    List<RuleTemplateAttributeBo> templateAttributes = template.getRuleTemplateAttributes();
    for (RuleTemplateAttributeBo templateAttribute : templateAttributes) {
        List<RoleName> roleNames = KEWServiceLocator.getWorkflowRuleAttributeMediator().getRoleNames(templateAttribute);
        for (RoleName role : roleNames) {
            if (role.getLabel().equals(roleName)) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:RoleServiceImpl.java

示例14: getRuleRows

import org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo; //导入依赖的package包/类
@Override
public WorkflowRuleAttributeRows getRuleRows(Map<String, String> parameters, RuleTemplateAttributeBo ruleTemplateAttribute) {
    required(ruleTemplateAttribute, "ruleTemplateAttribute");
    if (parameters == null) {
        parameters = Collections.emptyMap();
    }
    RuleAttribute ruleAttribute = ruleTemplateAttribute.getRuleAttribute();
    ExtensionDefinition extensionDefinition = RuleAttribute.to(ruleAttribute);
    WorkflowRuleAttributeHandlerService handler = getHandler(extensionDefinition);
    WorkflowRuleAttributeFields fields = handler.getRuleFields(parameters, extensionDefinition, ruleTemplateAttribute.isRequired());
    return new WorkflowRuleAttributeRows(fields);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:WorkflowRuleAttributeMediatorImpl.java

示例15: getRoutingDataRows

import org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo; //导入依赖的package包/类
@Override
public WorkflowRuleAttributeRows getRoutingDataRows(Map<String, String> parameters, RuleTemplateAttributeBo ruleTemplateAttribute) {
    required(ruleTemplateAttribute, "ruleTemplateAttribute");
    if (parameters == null) {
        parameters = Collections.emptyMap();
    }
    RuleAttribute ruleAttribute = ruleTemplateAttribute.getRuleAttribute();
    ExtensionDefinition extensionDefinition = RuleAttribute.to(ruleAttribute);
    WorkflowRuleAttributeHandlerService handler = getHandler(extensionDefinition);
    WorkflowRuleAttributeFields fields = handler.getRoutingDataFields(parameters, extensionDefinition, ruleTemplateAttribute.isRequired());
    return new WorkflowRuleAttributeRows(fields);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:WorkflowRuleAttributeMediatorImpl.java


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