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


Java ActionAttributeBo.setValue方法代码示例

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


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

示例1: 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);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:31,代码来源:KewToRulesEngineIntegrationTest.java

示例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());
    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);
    
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:31,代码来源:KewToRulesEngineIntegrationTest.java

示例3: 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;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:57,代码来源:KewToRulesEngineIntegrationTest.java

示例4: 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);

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

示例5: 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;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:60,代码来源:ValidationIntegrationTest.java

示例6: 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;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:56,代码来源:KewToRulesEngineIntegrationTest.java


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