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


Java ContextBo类代码示例

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


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

示例1: testValidWarning

import org.kuali.rice.krms.impl.repository.ContextBo; //导入依赖的package包/类
@Transactional
@Test
public void testValidWarning() {
    KrmsAttributeTypeDefinitionAndBuilders ruleDefs = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationRuleTypeService.VALIDATIONS_RULE_TYPE_CODE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            ValidationRuleType.VALID.toString(), true, ValidationRuleType.VALID.toString(),
            ValidationRuleType.VALID.getCode(), VALIDATION_RULE_TYPE_SERVICE, krmsTypeBoService, 1);
    KrmsAttributeTypeDefinitionAndBuilders actionDef = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationActionTypeService.VALIDATIONS_ACTION_TYPE_CODE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            ValidationActionType.WARNING.toString(), true, ValidationActionType.WARNING.toString(),
            ValidationActionType.WARNING.getCode(), VALIDATION_ACTION_TYPE_SERVICE, krmsTypeBoService, 1);
    KrmsAttributeTypeDefinitionAndBuilders actionMessageDef = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationActionTypeService.VALIDATIONS_ACTION_MESSAGE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            "Valdiation Action Message", true, "Valdiation Action Message",
            WARNING_MESSAGE, VALIDATION_ACTION_TYPE_SERVICE, krmsTypeBoService, 1);

    List<KrmsAttributeTypeDefinitionAndBuilders> actionDefs = new LinkedList<KrmsAttributeTypeDefinitionAndBuilders>();
    actionDefs.add(actionDef);
    actionDefs.add(actionMessageDef);
    ContextBo contextBo = createContext();
    RuleBo ruleBo = createRuleWithAction(ruleDefs, actionDefs, contextBo, WARNING_MESSAGE);
    createAgenda(ruleBo, contextBo, createEventAttributeDefinition());

    EngineResults results = engineExecute();
    assertTrue(results.getAttribute(ValidationActionTypeService.VALIDATIONS_ACTION_ATTRIBUTE) == null);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:27,代码来源:ValidationIntegrationTest.java

示例2: testValidError

import org.kuali.rice.krms.impl.repository.ContextBo; //导入依赖的package包/类
@Transactional
@Test
public void testValidError() {
    KrmsAttributeTypeDefinitionAndBuilders ruleDefs = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationRuleTypeService.VALIDATIONS_RULE_TYPE_CODE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            ValidationRuleType.VALID.toString(), true, ValidationRuleType.VALID.toString(),
            ValidationRuleType.VALID.getCode(), VALIDATION_RULE_TYPE_SERVICE, krmsTypeBoService, 1);
    KrmsAttributeTypeDefinitionAndBuilders actionDef = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationActionTypeService.VALIDATIONS_ACTION_TYPE_CODE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            ValidationActionType.ERROR.toString(), true, ValidationActionType.ERROR.toString(),
            ValidationActionType.ERROR.getCode(), VALIDATION_ACTION_TYPE_SERVICE, krmsTypeBoService, 1);
    KrmsAttributeTypeDefinitionAndBuilders actionMessageDef = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationActionTypeService.VALIDATIONS_ACTION_MESSAGE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            "Valdiation Action Message", true, "Valdiation Action Message",
            ERROR_MESSAGE, VALIDATION_ACTION_TYPE_SERVICE, krmsTypeBoService, 1);
    List<KrmsAttributeTypeDefinitionAndBuilders> actionDefs = new LinkedList<KrmsAttributeTypeDefinitionAndBuilders>();
    actionDefs.add(actionDef);
    actionDefs.add(actionMessageDef);

    ContextBo contextBo = createContext();
    RuleBo ruleBo = createRuleWithAction(ruleDefs, actionDefs, contextBo, ERROR_MESSAGE);
    createAgenda(ruleBo, contextBo, createEventAttributeDefinition());

    EngineResults results = engineExecute();
    assertTrue(results.getAttribute(ValidationActionTypeService.VALIDATIONS_ACTION_ATTRIBUTE) == null);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:27,代码来源:ValidationIntegrationTest.java

示例3: validateId

import org.kuali.rice.krms.impl.repository.ContextBo; //导入依赖的package包/类
private boolean validateId(ContextBo oldContext, ContextBo newContext, boolean isEditAction) {
    if (StringUtils.isBlank(newContext.getId())) {
        this.putFieldError(KRMSPropertyConstants.Context.CONTEXT_ID, "error.context.blankId");
        return false;
    }
    if (isEditAction) {
        if (!oldContext.getId().equals(newContext.getId())) {
            throw new IllegalStateException("The ID of a Context being edited must not change.");
        }
    } else {
        ContextDefinition contextInDatabase = getContextBoService().getContextByContextId(newContext.getId());
        if (contextInDatabase  != null) {
            this.putFieldError(KRMSPropertyConstants.Context.CONTEXT_ID, "error.context.duplicateId");
            return false;
        }
    }

    return true;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:ContextBusRule.java

示例4: loadTestData

import org.kuali.rice.krms.impl.repository.ContextBo; //导入依赖的package包/类
@Override
protected void loadTestData() throws Exception {
    loadXmlFile("KewToRulesEngineIntegrationTest.xml");
    dataObjectService = KRADServiceLocator.getDataObjectService();
    assertNotNull(dataObjectService);
    ruleManagementService = KrmsRepositoryServiceLocator.getService("ruleManagementService");
    PeopleFlowDefinition peopleFlow = createFirstPeopleFlow();
    this.peopleFlowIdAttributeDefinition = createPeopleFlowIdAttributeDefinition();
    this.peopleFlowNameAttributeDefinition = createPeopleFlowNameAttributeDefinition();
    KrmsAttributeDefinitionBo eventAttributeDefinition = createEventAttributeDefinition();
    this.approvalPeopleFlowActionType = createApprovalPeopleFlowActionType(peopleFlowIdAttributeDefinition);
    this.ruleBo = createRule(approvalPeopleFlowActionType, peopleFlowIdAttributeDefinition,
                             peopleFlowNameAttributeDefinition, peopleFlow.getId());
    ContextBo contextBo = createContext();
    createAgenda(ruleBo, contextBo, eventAttributeDefinition);
}
 
开发者ID:kuali,项目名称:rice,代码行数:17,代码来源:KewToRulesEngineIntegrationTest.java

示例5: createContext

import org.kuali.rice.krms.impl.repository.ContextBo; //导入依赖的package包/类
private ContextBo createContext() {
    // set up a simple default type for the context
    KrmsTypeRepositoryService krmsTypeRepositoryService = KrmsApiServiceLocator.getKrmsTypeRepositoryService();
    KrmsTypeDefinition.Builder typeDefinition = KrmsTypeDefinition.Builder.create(KrmsConstants.KRMS_NAMESPACE, "DefaultContextType");
    KrmsTypeDefinition defaultContextType = krmsTypeRepositoryService.createKrmsType(typeDefinition.build());

    ContextBo contextBo = new ContextBo();
    contextBo.setNamespace(KrmsConstants.KRMS_NAMESPACE);
    contextBo.setName("MyContext");
    contextBo.setTypeId(defaultContextType.getId());

    ContextDefinition contextDefinition = ruleManagementService.getContextByNameAndNamespace("MyContext", KrmsConstants.KRMS_NAMESPACE);

    if (contextDefinition == null) {

        return ContextBo.from(ruleManagementService.createContext(ContextBo.to(contextBo)));
    }

    ruleManagementService.updateContext(ContextBo.to(contextBo));

    return ContextBo.from(ruleManagementService.getContextByNameAndNamespace("MyContext", KrmsConstants.KRMS_NAMESPACE));
}
 
开发者ID:kuali,项目名称:rice,代码行数:23,代码来源:KewToRulesEngineIntegrationTest.java

示例6: processAfterCopy

import org.kuali.rice.krms.impl.repository.ContextBo; //导入依赖的package包/类
@Override
public void processAfterCopy(MaintenanceDocument document, Map<String, String[]> requestParameters) {
    ContextBo context = (ContextBo) document.getNewMaintainableObject().getDataObject();

    if (context.getId()== null) {
        context.setId(contextIdIncrementer.getNewId());
    }

    if(context.getName() == null) {
        context.setName(" Copy " + System.currentTimeMillis());
    }

    context.setAgendas(null);
    for (ContextAttributeBo attributeBo : context.getAttributeBos()) {
        attributeBo.setId(null);
        attributeBo.setVersionNumber(null);
    }

    super.processAfterCopy(document,
            requestParameters);
}
 
开发者ID:kuali,项目名称:rice,代码行数:22,代码来源:ContextMaintainable.java

示例7: testValidWarning

import org.kuali.rice.krms.impl.repository.ContextBo; //导入依赖的package包/类
@Transactional
@Test
public void testValidWarning() {
    KrmsAttributeTypeDefinitionAndBuilders ruleDefs = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationRuleTypeService.VALIDATIONS_RULE_TYPE_CODE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            ValidationRuleType.VALID.toString(), true, ValidationRuleType.VALID.toString(),
            ValidationRuleType.VALID.getCode(), VALIDATION_RULE_TYPE_SERVICE, krmsTypeRepositoryService, 1);
    KrmsAttributeTypeDefinitionAndBuilders actionDef = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationActionTypeService.VALIDATIONS_ACTION_TYPE_CODE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            ValidationActionType.WARNING.toString(), true, ValidationActionType.WARNING.toString(),
            ValidationActionType.WARNING.getCode(), VALIDATION_ACTION_TYPE_SERVICE, krmsTypeRepositoryService, 1);
    KrmsAttributeTypeDefinitionAndBuilders actionMessageDef = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationActionTypeService.VALIDATIONS_ACTION_MESSAGE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            "Valdiation Action Message", true, "Valdiation Action Message",
            WARNING_MESSAGE, VALIDATION_ACTION_TYPE_SERVICE, krmsTypeRepositoryService, 1);

    List<KrmsAttributeTypeDefinitionAndBuilders> actionDefs = new LinkedList<KrmsAttributeTypeDefinitionAndBuilders>();
    actionDefs.add(actionDef);
    actionDefs.add(actionMessageDef);
    ContextBo contextBo = createContext();
    RuleBo ruleBo = createRuleWithAction(ruleDefs, actionDefs, contextBo, WARNING_MESSAGE);
    createAgenda(ruleBo, contextBo, createEventAttributeDefinition());

    EngineResults results = engineExecute();
    assertTrue(results.getAttribute(ValidationActionTypeService.VALIDATIONS_ACTION_ATTRIBUTE) == null);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:27,代码来源:ValidationIntegrationTest.java

示例8: testValidError

import org.kuali.rice.krms.impl.repository.ContextBo; //导入依赖的package包/类
@Transactional
@Test
public void testValidError() {
    KrmsAttributeTypeDefinitionAndBuilders ruleDefs = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationRuleTypeService.VALIDATIONS_RULE_TYPE_CODE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            ValidationRuleType.VALID.toString(), true, ValidationRuleType.VALID.toString(),
            ValidationRuleType.VALID.getCode(), VALIDATION_RULE_TYPE_SERVICE, krmsTypeRepositoryService, 1);
    KrmsAttributeTypeDefinitionAndBuilders actionDef = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationActionTypeService.VALIDATIONS_ACTION_TYPE_CODE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            ValidationActionType.ERROR.toString(), true, ValidationActionType.ERROR.toString(),
            ValidationActionType.ERROR.getCode(), VALIDATION_ACTION_TYPE_SERVICE, krmsTypeRepositoryService, 1);
    KrmsAttributeTypeDefinitionAndBuilders actionMessageDef = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationActionTypeService.VALIDATIONS_ACTION_MESSAGE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            "Valdiation Action Message", true, "Valdiation Action Message",
            ERROR_MESSAGE, VALIDATION_ACTION_TYPE_SERVICE, krmsTypeRepositoryService, 1);
    List<KrmsAttributeTypeDefinitionAndBuilders> actionDefs = new LinkedList<KrmsAttributeTypeDefinitionAndBuilders>();
    actionDefs.add(actionDef);
    actionDefs.add(actionMessageDef);

    ContextBo contextBo = createContext();
    RuleBo ruleBo = createRuleWithAction(ruleDefs, actionDefs, contextBo, ERROR_MESSAGE);
    createAgenda(ruleBo, contextBo, createEventAttributeDefinition());

    EngineResults results = engineExecute();
    assertTrue(results.getAttribute(ValidationActionTypeService.VALIDATIONS_ACTION_ATTRIBUTE) == null);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:27,代码来源:ValidationIntegrationTest.java

示例9: retrieveObjectForEditOrCopy

import org.kuali.rice.krms.impl.repository.ContextBo; //导入依赖的package包/类
@Override
public Object retrieveObjectForEditOrCopy(MaintenanceDocument document, Map<String, String> dataObjectKeys) {

    TermSpecificationBo termSpecificationBo = (TermSpecificationBo) super.retrieveObjectForEditOrCopy(document,
            dataObjectKeys);

    if (!CollectionUtils.isEmpty(termSpecificationBo.getContextIds())) {
        for (String contextId : termSpecificationBo.getContextIds()) {
            ContextDefinition context =
                    KrmsRepositoryServiceLocator.getContextBoService().getContextByContextId(contextId);
            if (context != null) {
                termSpecificationBo.getContexts().add(ContextBo.from(context));
            }
        }
    }

    if (KRADConstants.MAINTENANCE_COPY_ACTION.equals(getMaintenanceAction())) {
        document.getDocumentHeader().setDocumentDescription("New Term Specification Document");
    }

    return termSpecificationBo;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:23,代码来源:TermSpecificationMaintainable.java

示例10: loadTestData

import org.kuali.rice.krms.impl.repository.ContextBo; //导入依赖的package包/类
@Override
protected void loadTestData() throws Exception {
    loadXmlFile("KewToRulesEngineIntegrationTest.xml");
    dataObjectService = KRADServiceLocator.getDataObjectService();
    assertNotNull(dataObjectService);
    PeopleFlowDefinition peopleFlow = createFirstPeopleFlow();
    this.peopleFlowIdAttributeDefinition = createPeopleFlowIdAttributeDefinition();
    this.peopleFlowNameAttributeDefinition = createPeopleFlowNameAttributeDefinition();
    KrmsAttributeDefinitionBo eventAttributeDefinition = createEventAttributeDefinition();
    this.approvalPeopleFlowActionType = createApprovalPeopleFlowActionType(peopleFlowIdAttributeDefinition);
    this.ruleBo = createRule(approvalPeopleFlowActionType, peopleFlowIdAttributeDefinition,
                             peopleFlowNameAttributeDefinition, peopleFlow.getId());
    ContextBo contextBo = createContext();
    createAgenda(ruleBo, contextBo, eventAttributeDefinition);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:KewToRulesEngineIntegrationTest.java

示例11: createContext

import org.kuali.rice.krms.impl.repository.ContextBo; //导入依赖的package包/类
private ContextBo createContext() {
    // set up a simple default type for the context
    KrmsTypeRepositoryService krmsTypeRepositoryService = KrmsApiServiceLocator.getKrmsTypeRepositoryService();
    KrmsTypeDefinition.Builder typeDefinition = KrmsTypeDefinition.Builder.create(KrmsConstants.KRMS_NAMESPACE, "DefaultContextType");
    KrmsTypeDefinition defaultContextType = krmsTypeRepositoryService.createKrmsType(typeDefinition.build());

    ContextBo contextBo = new ContextBo();
    contextBo.setNamespace(KrmsConstants.KRMS_NAMESPACE);
    contextBo.setName("MyContext");
    contextBo.setTypeId(defaultContextType.getId());
    return dataObjectService.save(contextBo, PersistenceOption.FLUSH);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:KewToRulesEngineIntegrationTest.java

示例12: createAgenda

import org.kuali.rice.krms.impl.repository.ContextBo; //导入依赖的package包/类
private AgendaBo createAgenda(RuleBo ruleBo, ContextBo contextBo, KrmsAttributeDefinitionBo eventAttributeDefinition) {
    // set up a simple default type for the agenda
    AgendaBo agendaBo = new AgendaBo();
    agendaBo.setActive(true);
    agendaBo.setContextId(contextBo.getId());
    agendaBo.setName("MyAgenda");
    agendaBo.setTypeId(null);
    agendaBo = dataObjectService.save(agendaBo, PersistenceOption.FLUSH);

    AgendaItemBo agendaItemBo = new AgendaItemBo();
    agendaItemBo.setRule(ruleBo);
    agendaItemBo.setAgendaId(agendaBo.getId());
    agendaItemBo = dataObjectService.save(agendaItemBo, PersistenceOption.FLUSH);

    List<AgendaItemBo> agendaItems = new ArrayList<AgendaItemBo>();
    agendaItems.add(agendaItemBo);
    agendaBo.setItems(agendaItems);
    agendaBo.setFirstItemId(agendaItemBo.getId());
    agendaBo.setFirstItem(agendaItemBo);

    // also add attribute to the agenda to store event
    Set<AgendaAttributeBo> agendaAttributes = new HashSet<AgendaAttributeBo>();
    agendaBo.setAttributeBos(agendaAttributes);
    AgendaAttributeBo agendaAttribute = new AgendaAttributeBo();
    agendaAttributes.add(agendaAttribute);
    agendaAttribute.setAttributeDefinition(eventAttributeDefinition);
    agendaAttribute.setValue("workflow");
    agendaAttribute.setAgenda(agendaBo);

    agendaBo = dataObjectService.save(agendaBo, PersistenceOption.FLUSH);

    contextBo.getAgendas().add(agendaBo);

    return agendaBo;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:36,代码来源:KewToRulesEngineIntegrationTest.java

示例13: testInvalidWarning

import org.kuali.rice.krms.impl.repository.ContextBo; //导入依赖的package包/类
@Transactional
@Test
public void testInvalidWarning() {
    KrmsAttributeTypeDefinitionAndBuilders ruleDefs = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationRuleTypeService.VALIDATIONS_RULE_TYPE_CODE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            ValidationRuleType.INVALID.toString(), true, ValidationRuleType.INVALID.toString(),
            ValidationRuleType.INVALID.getCode(), VALIDATION_RULE_TYPE_SERVICE, krmsTypeBoService, 1);
    KrmsAttributeTypeDefinitionAndBuilders actionDef = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationActionTypeService.VALIDATIONS_ACTION_TYPE_CODE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            ValidationActionType.WARNING.toString(), true, ValidationActionType.WARNING.toString(),
            ValidationActionType.WARNING.getCode(), VALIDATION_ACTION_TYPE_SERVICE, krmsTypeBoService, 1);
    KrmsAttributeTypeDefinitionAndBuilders actionMessageDef = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationActionTypeService.VALIDATIONS_ACTION_MESSAGE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            "Valdiation Action Message", true, "Valdiation Action Message",
            WARNING_MESSAGE, VALIDATION_ACTION_TYPE_SERVICE, krmsTypeBoService, 1);

    List<KrmsAttributeTypeDefinitionAndBuilders> actionDefs = new LinkedList<KrmsAttributeTypeDefinitionAndBuilders>();
    actionDefs.add(actionDef);
    actionDefs.add(actionMessageDef);

    ContextBo contextBo = createContext();
    RuleBo ruleBo = createRuleWithAction(ruleDefs, actionDefs, contextBo, WARNING_MESSAGE);
    createAgenda(ruleBo, contextBo, createEventAttributeDefinition());

    EngineResults results = engineExecute();
    assertNotNull(results.getAttribute(ValidationActionTypeService.VALIDATIONS_ACTION_ATTRIBUTE));
    assertEquals(ValidationActionType.WARNING.getCode() + ":" + WARNING_MESSAGE,
            results.getAttribute(ValidationActionTypeService.VALIDATIONS_ACTION_ATTRIBUTE));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:30,代码来源:ValidationIntegrationTest.java

示例14: testInvalidError

import org.kuali.rice.krms.impl.repository.ContextBo; //导入依赖的package包/类
@Transactional
@Test
public void testInvalidError() {
    KrmsAttributeTypeDefinitionAndBuilders ruleDefs = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationRuleTypeService.VALIDATIONS_RULE_TYPE_CODE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            ValidationRuleType.INVALID.toString(), true, ValidationRuleType.INVALID.toString(),
            ValidationRuleType.INVALID.getCode(), VALIDATION_RULE_TYPE_SERVICE, krmsTypeBoService, 1);
    KrmsAttributeTypeDefinitionAndBuilders actionDef = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationActionTypeService.VALIDATIONS_ACTION_TYPE_CODE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            ValidationActionType.ERROR.toString(), true, ValidationActionType.ERROR.toString(),
            ValidationActionType.ERROR.getCode(), VALIDATION_ACTION_TYPE_SERVICE, krmsTypeBoService, 1);
    KrmsAttributeTypeDefinitionAndBuilders actionMessageDef = createKrmsAttributeTypeDefinitionAndBuilders(
            ValidationActionTypeService.VALIDATIONS_ACTION_MESSAGE_ATTRIBUTE, KrmsConstants.KRMS_NAMESPACE,
            "Valdiation Action Message", true, "Valdiation Action Message",
            ERROR_MESSAGE, VALIDATION_ACTION_TYPE_SERVICE, krmsTypeBoService, 1);
    List<KrmsAttributeTypeDefinitionAndBuilders> actionDefs = new LinkedList<KrmsAttributeTypeDefinitionAndBuilders>();
    actionDefs.add(actionDef);
    actionDefs.add(actionMessageDef);

    ContextBo contextBo = createContext();
    RuleBo ruleBo = createRuleWithAction(ruleDefs, actionDefs, contextBo, ERROR_MESSAGE);
    createAgenda(ruleBo, contextBo, createEventAttributeDefinition());

    EngineResults results = engineExecute();
    assertNotNull(results.getAttribute(ValidationActionTypeService.VALIDATIONS_ACTION_ATTRIBUTE));
    assertEquals(ValidationActionType.ERROR.getCode() + ":" + ERROR_MESSAGE, results.getAttribute(
            ValidationActionTypeService.VALIDATIONS_ACTION_ATTRIBUTE));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:ValidationIntegrationTest.java

示例15: createContextDefinition

import org.kuali.rice.krms.impl.repository.ContextBo; //导入依赖的package包/类
private ContextDefinition createContextDefinition(String nameSpace) {
    // Attribute Defn for context;
    KrmsAttributeDefinition.Builder contextTypeAttributeDefnBuilder = KrmsAttributeDefinition.Builder.create(null, "Context1Qualifier", nameSpace);
    contextTypeAttributeDefnBuilder.setLabel("Context 1 Qualifier");
    KrmsAttributeDefinition contextTypeAttributeDefinition = krmsAttributeDefinitionService.createAttributeDefinition(contextTypeAttributeDefnBuilder.build());

    // Attr for context;
    KrmsTypeAttribute.Builder krmsTypeAttrBuilder = KrmsTypeAttribute.Builder.create(null, contextTypeAttributeDefinition.getId(), 1);

    // KrmsType for context
    KrmsTypeDefinition.Builder krmsContextTypeDefnBuilder = KrmsTypeDefinition.Builder.create("KrmsTestContextType", nameSpace);
    krmsContextTypeDefnBuilder.setAttributes(Collections.singletonList(krmsTypeAttrBuilder));
    KrmsTypeDefinition krmsContextTypeDefinition = krmsContextTypeDefnBuilder.build();
    krmsContextTypeDefinition = krmsTypeBoService.createKrmsType(krmsContextTypeDefinition);

    // Context
    ContextDefinition.Builder contextBuilder = ContextDefinition.Builder.create(nameSpace, CONTEXT_NAME);
    contextBuilder.setTypeId(krmsContextTypeDefinition.getId());
    ContextDefinition contextDefinition = contextBuilder.build();
    contextDefinition = contextRepository.createContext(contextDefinition);

    // Context Attribute
    // TODO: do this fur eel
    ContextAttributeBo contextAttribute = new ContextAttributeBo();
    contextAttribute.setAttributeDefinition(KrmsAttributeDefinitionBo.from(contextTypeAttributeDefinition));
    contextAttribute.setContext(ContextBo.from(contextDefinition));
    contextAttribute.setValue("BLAH");
    getDataObjectService().save(contextAttribute, PersistenceOption.FLUSH);

    return contextDefinition;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:32,代码来源:ValidationIntegrationTest.java


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