本文整理汇总了Java中org.kuali.rice.krms.impl.repository.ActionAttributeBo类的典型用法代码示例。如果您正苦于以下问题:Java ActionAttributeBo类的具体用法?Java ActionAttributeBo怎么用?Java ActionAttributeBo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActionAttributeBo类属于org.kuali.rice.krms.impl.repository包,在下文中一共展示了ActionAttributeBo类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: forceLoadLazyRelations
import org.kuali.rice.krms.impl.repository.ActionAttributeBo; //导入依赖的package包/类
private void forceLoadLazyRelations(AgendaBo agenda) {
for (AgendaItemBo item : agenda.getItems()) {
for (ActionBo action : item.getRule().getActions()) {
if (CollectionUtils.isEmpty(action.getAttributeBos())) { continue; }
for (ActionAttributeBo actionAttribute : action.getAttributeBos()) {
actionAttribute.getAttributeDefinition();
}
}
Tree propTree = item.getRule().refreshPropositionTree(true);
walkPropositionTree(item.getRule().getProposition());
for (RuleAttributeBo ruleAttribute : item.getRule().getAttributeBos()) {
ruleAttribute.getAttributeDefinition();
}
}
}
示例2: addAnotherPeopleFlow
import org.kuali.rice.krms.impl.repository.ActionAttributeBo; //导入依赖的package包/类
private void addAnotherPeopleFlow(RuleBo ruleBo) {
String testuser1 = getPrincipalIdForName("testuser1");
PeopleFlowDefinition.Builder peopleFlowBuilder = PeopleFlowDefinition.Builder.create("TEST", "PeopleFlow2");
peopleFlowBuilder.addPrincipal(testuser1).setPriority(1);
PeopleFlowDefinition peopleFlow = KewApiServiceLocator.getPeopleFlowService().createPeopleFlow(peopleFlowBuilder.build());
// create the action with an attribute pointing to a peopleflow
ActionBo peopleFlowAction = new ActionBo();
ruleBo.getActions().add(peopleFlowAction);
peopleFlowAction.setNamespace("TEST");
peopleFlowAction.setName("PeopleFlowApprovalAction2");
peopleFlowAction.setSequenceNumber(2);
peopleFlowAction.setTypeId(approvalPeopleFlowActionType.getId());
List<ActionAttributeBo> actionAttributes = new ArrayList<ActionAttributeBo>();
peopleFlowAction.setAttributeBos(actionAttributes);
peopleFlowAction.setRule(ruleBo);
ActionAttributeBo actionAttribute = new ActionAttributeBo();
actionAttributes.add(actionAttribute);
actionAttribute.setAttributeDefinition(KrmsAttributeDefinitionBo.from(peopleFlowIdAttributeDefinition));
actionAttribute.setValue(peopleFlow.getId());
actionAttribute.setAction(peopleFlowAction);
ActionAttributeBo actionNameAttribute = new ActionAttributeBo();
actionAttributes.add(actionNameAttribute);
actionNameAttribute.setAttributeDefinition(KrmsAttributeDefinitionBo.from(peopleFlowNameAttributeDefinition));
actionNameAttribute.setValue(peopleFlowAction.getName() + " Name attr");
actionNameAttribute.setAction(peopleFlowAction);
dataObjectService.save(ruleBo, PersistenceOption.FLUSH);
}
示例3: addAnotherPeopleFlow
import org.kuali.rice.krms.impl.repository.ActionAttributeBo; //导入依赖的package包/类
private void addAnotherPeopleFlow(RuleBo ruleBo) {
String testuser1 = getPrincipalIdForName("testuser1");
PeopleFlowDefinition.Builder peopleFlowBuilder = PeopleFlowDefinition.Builder.create("TEST", "PeopleFlow2");
peopleFlowBuilder.addPrincipal(testuser1).setPriority(1);
PeopleFlowDefinition peopleFlow = KewApiServiceLocator.getPeopleFlowService().createPeopleFlow(peopleFlowBuilder.build());
// create the action with an attribute pointing to a peopleflow
ActionBo peopleFlowAction = new ActionBo();
ruleBo.getActions().add(peopleFlowAction);
peopleFlowAction.setNamespace("TEST");
peopleFlowAction.setName("PeopleFlowApprovalAction2");
peopleFlowAction.setSequenceNumber(2);
peopleFlowAction.setTypeId(approvalPeopleFlowActionType.getId());
Set<ActionAttributeBo> actionAttributes = new HashSet<ActionAttributeBo>();
peopleFlowAction.setAttributeBos(actionAttributes);
ActionAttributeBo actionAttribute = new ActionAttributeBo();
actionAttributes.add(actionAttribute);
actionAttribute.setAttributeDefinitionId(peopleFlowIdAttributeDefinition.getId());
actionAttribute.setAttributeDefinition(KrmsAttributeDefinitionBo.from(peopleFlowIdAttributeDefinition));
actionAttribute.setValue(peopleFlow.getId());
ActionAttributeBo actionNameAttribute = new ActionAttributeBo();
actionAttributes.add(actionNameAttribute);
actionNameAttribute.setAttributeDefinitionId(peopleFlowNameAttributeDefinition.getId());
actionNameAttribute.setAttributeDefinition(KrmsAttributeDefinitionBo.from(peopleFlowNameAttributeDefinition));
actionNameAttribute.setValue(peopleFlowAction.getName() + " Name attr");
businessObjectService.save(ruleBo);
}
示例4: createRule
import org.kuali.rice.krms.impl.repository.ActionAttributeBo; //导入依赖的package包/类
/**
* Creates a rule linked with the given action type and people flow action
* @param actionType
* @param peopleFlowIdAttributeDefinition
* @param peopleFlowId
*/
private RuleBo createRule(KrmsTypeDefinition actionType, KrmsAttributeDefinition peopleFlowIdAttributeDefinition,
KrmsAttributeDefinition peopleFlowNameAttributeDefinition, String peopleFlowId) {
RuleBo rule = new RuleBo();
rule.setNamespace("TEST");
rule.setName("PeopleFlowRule");
// no propositions on this rule so it should (hopefully) always evaluate to true
List<ActionBo> actions = new ArrayList<ActionBo>();
rule.setActions(actions);
// create the action with an attribute pointing to a peopleflow
ActionBo peopleFlowAction = new ActionBo();
actions.add(peopleFlowAction);
peopleFlowAction.setNamespace("TEST");
peopleFlowAction.setName("PeopleFlowApprovalAction");
peopleFlowAction.setSequenceNumber(1);
peopleFlowAction.setTypeId(actionType.getId());
List<ActionAttributeBo> actionAttributes = new ArrayList<ActionAttributeBo>();
peopleFlowAction.setAttributeBos(actionAttributes);
peopleFlowAction.setRule(rule);
ActionAttributeBo actionAttribute = new ActionAttributeBo();
actionAttributes.add(actionAttribute);
actionAttribute.setAttributeDefinition(KrmsAttributeDefinitionBo.from(peopleFlowIdAttributeDefinition));
actionAttribute.setValue(peopleFlowId);
actionAttribute.setAction(peopleFlowAction);
ActionAttributeBo actionNameAttribute = new ActionAttributeBo();
actionAttributes.add(actionNameAttribute);
actionNameAttribute.setAttributeDefinition(KrmsAttributeDefinitionBo.from(peopleFlowNameAttributeDefinition));
actionNameAttribute.setValue(peopleFlowAction.getName() + " Name attr");
actionNameAttribute.setAction(peopleFlowAction);
// set up a simple default type for the rule
KrmsTypeRepositoryService krmsTypeRepositoryService = KrmsApiServiceLocator.getKrmsTypeRepositoryService();
KrmsTypeDefinition.Builder typeDefinition = KrmsTypeDefinition.Builder.create("PeopleFlowRule Name", KrmsConstants.KRMS_NAMESPACE);
typeDefinition.setServiceName("defaultRuleTypeService");
KrmsTypeDefinition defaultRuleType = krmsTypeRepositoryService.createKrmsType(typeDefinition.build());
assertNotNull(defaultRuleType);
assertNotNull(defaultRuleType.getId());
// now assign the default type to the rule and save it
rule.setTypeId(defaultRuleType.getId());
rule = dataObjectService.save(rule, PersistenceOption.FLUSH);
assertNotNull(rule.getId());
assertEquals(1, rule.getActions().size());
assertNotNull(rule.getActions().get(0).getId());
assertEquals(2, rule.getActions().get(0).getAttributeBos().size());
return rule;
}
示例5: testUpdateAgendaItem
import org.kuali.rice.krms.impl.repository.ActionAttributeBo; //导入依赖的package包/类
@Test
public void testUpdateAgendaItem() {
ContextDefinition context = getContextRepository().getContextByNameAndNamespace(CONTEXT1, NAMESPACE1);
assertNotNull("context " + CONTEXT1 + " not found", context);
AgendaDefinition agenda = getAgendaBoService().getAgendaByNameAndContextId(AGENDA1, context.getId());
assertNotNull("agenda " + AGENDA1 + " not found", agenda);
AgendaItemDefinition agendaItem = getAgendaBoService().getAgendaItemById(agenda.getFirstItemId());
assertNotNull("agenda item " + agenda.getFirstItemId() + " not found", agendaItem);
KrmsAttributeDefinition attributeDefinition = getKrmsAttributeDefinitionService().createAttributeDefinition(
KrmsAttributeDefinition.Builder.create(null, ATTRIBUTE1, NAMESPACE1).build());
KrmsAttributeDefinitionBo attributeDefinitionBo = KrmsAttributeDefinitionBo.from(attributeDefinition);
// verify the agenda item
AgendaItemBo agendaItemBo = AgendaItemBo.from(agendaItem);
assertNotNull("agenda item null", agendaItemBo);
List<ActionBo> agendaItemActionBos = agendaItemBo.getRule().getActions();
assertEquals("incorrect number of agenda item rule actions found", 1, agendaItemActionBos.size());
ActionBo agendaItemActionBo = agendaItemActionBos.get(0);
assertTrue("agenda item rule action attributes found", agendaItemActionBo.getAttributes().isEmpty());
assertTrue("agenda item rule action attributes found", agendaItemActionBo.getAttributeBos().isEmpty());
// verify the child agenda item
AgendaItemBo alwaysBo = agendaItemBo.getAlways();
assertNotNull("always agenda item null", alwaysBo);
List<ActionBo> alwaysActionBos = alwaysBo.getRule().getActions();
assertEquals("incorrect number of always agenda item rule actions found", 1, alwaysActionBos.size());
ActionBo alwaysActionBo = alwaysActionBos.get(0);
assertTrue("always agenda item rule action attributes found", alwaysActionBo.getAttributes().isEmpty());
assertTrue("always agenda item rule action attributes found", alwaysActionBo.getAttributeBos().isEmpty());
// add agenda item attribute
ActionAttributeBo agendaItemActionAttributeBo = new ActionAttributeBo();
agendaItemActionAttributeBo.setAction(agendaItemActionBo);
agendaItemActionAttributeBo.setAttributeDefinition(attributeDefinitionBo);
agendaItemActionAttributeBo.setValue("testAgendaItem");
agendaItemActionBo.setAttributeBos(Arrays.asList(agendaItemActionAttributeBo));
// add child agenda item attribute
ActionAttributeBo whenAlwaysActionAttributeBo = new ActionAttributeBo();
whenAlwaysActionAttributeBo.setAction(alwaysActionBo);
whenAlwaysActionAttributeBo.setAttributeDefinition(attributeDefinitionBo);
whenAlwaysActionAttributeBo.setValue("testAlwaysAgendaItem");
alwaysActionBo.setAttributeBos(Arrays.asList(whenAlwaysActionAttributeBo));
// update the agenda item
AgendaItemDefinition updatedAgendaItem
= getAgendaBoService().updateAgendaItem(AgendaItemDefinition.Builder.create(agendaItemBo).build());
// verify the updated agenda item
AgendaItemBo updatedAgendaItemBo = AgendaItemBo.from(updatedAgendaItem);
assertNotNull("updated agenda item null", updatedAgendaItemBo);
List<ActionBo> updatedAgendaItemActionBos = updatedAgendaItemBo.getRule().getActions();
assertEquals("incorrect number of updated agenda item rule actions found", 1, updatedAgendaItemActionBos.size());
ActionBo updatedAgendaItemActionBo = updatedAgendaItemActionBos.get(0);
assertEquals("incorrect number of updated agenda item rule action attributes found", 1, updatedAgendaItemActionBo.getAttributes().size());
assertEquals("incorrect number of updated agenda item rule action attributes found", 1, updatedAgendaItemActionBo.getAttributeBos().size());
// verify the updated child agenda item
AgendaItemBo updatedAlwaysBo = updatedAgendaItemBo.getAlways();
assertNotNull("updated always agenda item null", updatedAlwaysBo);
List<ActionBo> updatedAlwaysActionBos = updatedAlwaysBo.getRule().getActions();
assertEquals("incorrect number of updated always agenda item rule actions found", 1, updatedAlwaysActionBos.size());
ActionBo updatedAlwaysActionBo = updatedAlwaysActionBos.get(0);
assertEquals("incorrect number of updated always agenda item rule action attributes found", 1, updatedAlwaysActionBo.getAttributes().size());
assertEquals("incorrect number of updated always agenda item rule action attributes found", 1, updatedAlwaysActionBo.getAttributeBos().size());
// Check to make sure there are no orphaned records
KrmsAttributeDefinition orgAttribute = getKrmsAttributeDefinitionService().getAttributeDefinitionById( attributeDefinition.getId() );
assertEquals("incorrect number of updated attributes found for the agenda", 1, getAgendaBoService().getAgendaByAgendaId(updatedAgendaItem.getAgendaId()).getAttributes().size());
assertNotNull("Attribute definition orphaned on AgendaItem update", orgAttribute);
}
示例6: createRuleWithAction
import org.kuali.rice.krms.impl.repository.ActionAttributeBo; //导入依赖的package包/类
private RuleBo createRuleWithAction(KrmsAttributeTypeDefinitionAndBuilders ruleBits,
List<KrmsAttributeTypeDefinitionAndBuilders> actionBits, ContextBo contextBo, String message) {
RuleBo rule = new RuleBo();
rule.setTypeId(ruleBits.typeDef.getId());
rule.setNamespace(ruleBits.typeDef.getNamespace());
rule.setName(ruleBits.typeDef.getName());
ActionBo action = new ActionBo();
action.setTypeId(actionBits.get(0).typeDef.getId());
action.setDescription("Description of validation action for message " + actionBits.get(0).attribDef.getDescription());
action.setNamespace(actionBits.get(0).typeDef.getNamespace());
action.setName(actionBits.get(0).typeDef.getName());
action.setSequenceNumber(actionBits.get(0).typeAttribBuilder.getSequenceNumber());
List<ActionAttributeBo> actionAttributes = new ArrayList<ActionAttributeBo>();
action.setAttributeBos(actionAttributes);
for (KrmsAttributeTypeDefinitionAndBuilders actionBit : actionBits) {
ActionAttributeBo actionAttribute = new ActionAttributeBo();
actionAttributes.add(actionAttribute);
actionAttribute.setAttributeDefinition(KrmsAttributeDefinitionBo.from(actionBit.attribDef));
actionAttribute.setValue(actionBit.typeAttribBuilder.getTypeId());
actionAttribute.setAction(action);
// createActionAttributeBo(actionBit.attribDef.getNamespace(), actionBit.attribDef.getName(), "Action Message", actionBit.attribDef.isActive(), actionBit.attribDef.getDescription(), message, actionAttributes);
}
rule.getActions().add(action);
action.setRule(rule);
rule = getDataObjectService().save(rule, PersistenceOption.FLUSH);
// set attributes
RuleAttributeBo ruleType = new RuleAttributeBo();
ruleType.setAttributeDefinition(KrmsAttributeDefinitionBo.from(ruleBits.attribDef));
ruleType.setValue(ruleBits.typeAttribBuilder.getTypeId());
ruleType.setRule(rule);
rule.getAttributeBos().add(ruleType);
rule = getDataObjectService().save(rule, PersistenceOption.FLUSH);
RuleDefinition ruleDef = RuleBo.to(rule);
PropositionDefinition propDef = createPropositionDefinition1(ContextBo.to(contextBo), ruleDef).build();
propDef = propositionBoService.createProposition(propDef);
rule.setProposition(PropositionBo.from(propDef));
rule = getDataObjectService().save(rule, PersistenceOption.FLUSH);
assertNotNull(rule.getId());
assertNotNull(propDef.getId());
assertEquals(propDef.getRuleId(), rule.getId());
assertEquals(1, rule.getActions().size());
assertNotNull(rule.getActions().get(0).getId());
assertEquals(2, rule.getActions().get(0).getAttributeBos().size());
return rule;
}
示例7: createRule
import org.kuali.rice.krms.impl.repository.ActionAttributeBo; //导入依赖的package包/类
/**
* Creates a rule linked with the given action type and people flow action
* @param actionType
* @param peopleFlowIdAttributeDefinition
* @param peopleFlowId
*/
private RuleBo createRule(KrmsTypeDefinition actionType, KrmsAttributeDefinition peopleFlowIdAttributeDefinition,
KrmsAttributeDefinition peopleFlowNameAttributeDefinition, String peopleFlowId) {
RuleBo rule = new RuleBo();
rule.setNamespace("TEST");
rule.setName("PeopleFlowRule");
// no propositions on this rule so it should (hopefully) always evaluate to true
List<ActionBo> actions = new ArrayList<ActionBo>();
rule.setActions(actions);
// create the action with an attribute pointing to a peopleflow
ActionBo peopleFlowAction = new ActionBo();
actions.add(peopleFlowAction);
peopleFlowAction.setNamespace("TEST");
peopleFlowAction.setName("PeopleFlowApprovalAction");
peopleFlowAction.setSequenceNumber(1);
peopleFlowAction.setTypeId(actionType.getId());
Set<ActionAttributeBo> actionAttributes = new HashSet<ActionAttributeBo>();
peopleFlowAction.setAttributeBos(actionAttributes);
ActionAttributeBo actionAttribute = new ActionAttributeBo();
actionAttributes.add(actionAttribute);
actionAttribute.setAttributeDefinitionId(peopleFlowIdAttributeDefinition.getId());
actionAttribute.setAttributeDefinition(KrmsAttributeDefinitionBo.from(peopleFlowIdAttributeDefinition));
actionAttribute.setValue(peopleFlowId);
ActionAttributeBo actionNameAttribute = new ActionAttributeBo();
actionAttributes.add(actionNameAttribute);
actionNameAttribute.setAttributeDefinitionId(peopleFlowNameAttributeDefinition.getId());
actionNameAttribute.setAttributeDefinition(KrmsAttributeDefinitionBo.from(peopleFlowNameAttributeDefinition));
actionNameAttribute.setValue(peopleFlowAction.getName() + " Name attr");
// set up a simple default type for the rule
KrmsTypeRepositoryService krmsTypeRepositoryService = KrmsApiServiceLocator.getKrmsTypeRepositoryService();
KrmsTypeDefinition.Builder typeDefinition = KrmsTypeDefinition.Builder.create("PeopleFlowRule Name", KrmsConstants.KRMS_NAMESPACE);
typeDefinition.setServiceName("defaultRuleTypeService");
KrmsTypeDefinition defaultRuleType = krmsTypeRepositoryService.createKrmsType(typeDefinition.build());
assertNotNull(defaultRuleType);
assertNotNull(defaultRuleType.getId());
// now assign the default type to the rule and save it
rule.setTypeId(defaultRuleType.getId());
rule = businessObjectService.save(rule);
assertNotNull(rule.getId());
assertEquals(1, rule.getActions().size());
assertNotNull(rule.getActions().get(0).getId());
assertEquals(2, rule.getActions().get(0).getAttributeBos().size());
return rule;
}