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


Java TermDefinition类代码示例

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


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

示例1: updateTermChangeParameterTest

import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入依赖的package包/类
/**
 * Verify that Terms can be updated (including modification of an existing TermParameter) by the TermBoServiceImpl
 */
@Test
public void updateTermChangeParameterTest() {
    TermDefinition termDefinition = createTermForUpdate();

    // Change some things so that we can verify the updates occurred
    TermDefinition.Builder updateTermBuilder = TermDefinition.Builder.create(termDefinition);
    updateTermBuilder.setDescription("updated description");
    assertTrue(updateTermBuilder.getParameters().size() == 1);
    updateTermBuilder.getParameters().get(0).setValue("updatedParamValue");

    termBoService.updateTerm(updateTermBuilder.build());

    // check that the update stuck
    TermDefinition updatedTerm = termBoService.getTerm(termDefinition.getId());

    assertFalse("descriptions should not be equal after update",
            updatedTerm.getDescription().equals(termDefinition.getDescription()));

    assertTrue(updatedTerm.getParameters().size() == 1);

    TermParameterDefinition updatedParam = updatedTerm.getParameters().get(0);
    assertTrue(updatedParam.getValue().equals("updatedParamValue"));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:27,代码来源:TermRelatedBoTest.java

示例2: updateTermReplaceParameterTest

import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入依赖的package包/类
/**
 * Verify that Terms can be updated (including replacement of a TermParameter) by the TermBoServiceImpl
 */
@Test
public void updateTermReplaceParameterTest() {
    TermDefinition termDefinition = createTermForUpdate();

    // Change some things so that we can verify the updates occurred
    TermDefinition.Builder updateTermBuilder = TermDefinition.Builder.create(termDefinition);
    updateTermBuilder.setDescription("updated description");
    assertTrue(updateTermBuilder.getParameters().size() == 1);
    updateTermBuilder.getParameters().clear();
    updateTermBuilder.getParameters().add(TermParameterDefinition.Builder.create(null, termDefinition.getId(), "secondParamName", "secondParamValue"));

    termBoService.updateTerm(updateTermBuilder.build());

    // check that the update stuck
    TermDefinition updatedTerm = termBoService.getTerm(termDefinition.getId());

    assertFalse("descriptions should not be equal after update",
            updatedTerm.getDescription().equals(termDefinition.getDescription()));

    assertTrue(updatedTerm.getParameters().size() == 1);

    TermParameterDefinition secondParam = updatedTerm.getParameters().get(0);
    assertTrue(secondParam.getValue().equals("secondParamValue"));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:TermRelatedBoTest.java

示例3: createTermForUpdate

import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入依赖的package包/类
private TermDefinition createTermForUpdate() {
    ContextDefinition contextDefinition = createContext();

    // TermSpec -- we need one to create a term
    TermSpecificationDefinition termSpec =
            TermSpecificationDefinition.Builder.create(null, "TermUpdateTestTermSpec", contextDefinition.getId(),
                    "java.lang.String").build();
    termSpec = termBoService.createTermSpecification(termSpec);

    // Term -- create the term that we'll update
    List<TermParameterDefinition.Builder> paramBuilders =
            Arrays.asList(TermParameterDefinition.Builder.create(null, null, "paramName", "paramValue"));
    TermDefinition termDefinition =
            TermDefinition.Builder.create(null, TermSpecificationDefinition.Builder.create(termSpec), paramBuilders).build();
    termDefinition = termBoService.createTerm(termDefinition);
    return termDefinition;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:TermRelatedBoTest.java

示例4: createTerm

import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入依赖的package包/类
@Override
public TermDefinition createTerm(TermDefinition termDef) throws RiceIllegalArgumentException {
    try {
        TermDefinition orig = this.getTerm(termDef.getId());
        if (orig != null) {
            throw new RiceIllegalArgumentException(termDef.getId());
        }
    } catch (RiceIllegalArgumentException ex) {
        // same as getting null
    }
    TermDefinition.Builder copy = TermDefinition.Builder.create(termDef);
    if (copy.getId() == null) {
        copy.setId(UUID.randomUUID().toString());
    }
    TermDefinition termDefinition = copy.build();
    termMap.put(termDefinition.getId(), termDefinition);
    return termDefinition;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:TermRepositoryServiceMockImpl.java

示例5: getTerm

import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krms.impl.repository.TermBoService#getTerm(java.lang.String)
 */
@Override
public TermDefinition getTerm(String id) {
    TermDefinition result = null;

    if (StringUtils.isBlank(id)) {
        throw new RiceIllegalArgumentException("id must not be blank or null");
    }

    TermBo termBo = getDataObjectService().find(TermBo.class, id);

    if (termBo != null) {
        result = TermBo.to(termBo);
    }

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

示例6: from

import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入依赖的package包/类
/**
 * Converts a immutable object to it's mutable bo counterpart
 *
 * @param im immutable object
 * @return the mutable bo
 */
public static TermBo from(TermDefinition im) {
    if (im == null) {
        return null;
    }

    TermBo bo = new TermBo();
    bo.id = im.getId();
    bo.specificationId = im.getSpecification().getId();
    bo.description = im.getDescription();
    bo.specification = TermSpecificationBo.from(im.getSpecification());
    bo.parameters = new ArrayList<TermParameterBo>();

    for (TermParameterDefinition parm : im.getParameters()) {
        TermParameterBo termParmBo = TermParameterBo.from(parm);
        bo.parameters.add(termParmBo);
        termParmBo.setTerm(bo);
    }

    bo.versionNumber = im.getVersionNumber();

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

示例7: buildSimplePropositionContextMap

import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入依赖的package包/类
protected Map<String, Object> buildSimplePropositionContextMap(PropositionDefinition proposition) {
    if (!proposition.getPropositionTypeCode().equals(PropositionType.SIMPLE.getCode())) {
        throw new RiceIllegalArgumentException("proposition is not simple " + proposition.getPropositionTypeCode() + " " + proposition.getId() + proposition.getDescription());
    }
    Map<String, Object> contextMap = new LinkedHashMap<String, Object>();
    for (PropositionParameter param : proposition.getParameters()) {
        if (param.getParameterType().equals(PropositionParameterType.TERM.getCode())) {
            TermDefinition term = param.getTermValue();
            if ((term == null) && (StringUtils.isNotBlank(param.getValue()))) {
               term = this.termRepositoryService.getTerm(param.getValue());
            }
            if (term != null) {
                for (TermParameterDefinition termParam : term.getParameters()) {
                    contextMap.put(termParam.getName(), termParam.getValue());
                }
            } else {
                contextMap.put(param.getParameterType(), param.getValue());
            }
        } else {
            contextMap.put(param.getParameterType(), param.getValue());
        }
    }
    return contextMap;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:TranslationUtility.java

示例8: flushCacheBeforeSave

import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入依赖的package包/类
private void flushCacheBeforeSave(){
    //flush krms caches
    DistributedCacheManagerDecorator distributedCacheManagerDecorator =
            GlobalResourceLoader.getService(KrmsConstants.KRMS_DISTRIBUTED_CACHE);

    distributedCacheManagerDecorator.getCache(ActionDefinition.Cache.NAME).clear();
    distributedCacheManagerDecorator.getCache(AgendaItemDefinition.Cache.NAME).clear();
    distributedCacheManagerDecorator.getCache(AgendaTreeDefinition.Cache.NAME).clear();
    distributedCacheManagerDecorator.getCache(AgendaDefinition.Cache.NAME).clear();
    distributedCacheManagerDecorator.getCache(ContextDefinition.Cache.NAME).clear();
    distributedCacheManagerDecorator.getCache(KrmsAttributeDefinition.Cache.NAME).clear();
    distributedCacheManagerDecorator.getCache(KrmsTypeDefinition.Cache.NAME).clear();
    distributedCacheManagerDecorator.getCache(RuleDefinition.Cache.NAME).clear();
    distributedCacheManagerDecorator.getCache(PropositionDefinition.Cache.NAME).clear();
    distributedCacheManagerDecorator.getCache(RuleDefinition.Cache.NAME).clear();
    distributedCacheManagerDecorator.getCache(TermDefinition.Cache.NAME).clear();
    distributedCacheManagerDecorator.getCache(TermResolverDefinition.Cache.NAME).clear();
    distributedCacheManagerDecorator.getCache(TermSpecificationDefinition.Cache.NAME).clear();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:AgendaEditorMaintainable.java

示例9: lookupTermType

import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入依赖的package包/类
/**
 * Lookup the {@link org.kuali.rice.krms.api.repository.term.TermSpecificationDefinitionContract} type.
 * @param key krms_term_t key
 * @return String the krms_term_spec_t TYP for the given krms_term_t key given
 */
private String lookupTermType(String key) {
    TermSpecificationDefinition termSpec = null;
    if (key.startsWith(KrmsImplConstants.PARAMETERIZED_TERM_PREFIX)) {
        String termSpecificationId = key.substring(KrmsImplConstants.PARAMETERIZED_TERM_PREFIX.length());
        termSpec = KrmsRepositoryServiceLocator.getTermBoService().getTermSpecificationById(termSpecificationId);
    } else {
        TermDefinition term = KrmsRepositoryServiceLocator.getTermBoService().getTerm(key);
        if (term != null) {
            termSpec = term.getSpecification();
        }
    }
    if (termSpec != null) {
        return termSpec.getType();
    } else {
        return null;
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:23,代码来源:AgendaEditorController.java

示例10: translateTermDefinition

import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入依赖的package包/类
protected Term translateTermDefinition(TermDefinition termDefinition) {
	if (termDefinition == null) {
		throw new RepositoryDataException("Given TermDefinition is null");
	}
	TermSpecificationDefinition termSpecificationDefinition = termDefinition.getSpecification();
	if (termSpecificationDefinition == null) { throw new RepositoryDataException("term with id " + termDefinition.getId() + " has a null specification"); } 
	
	List<TermParameterDefinition> params = termDefinition.getParameters();
	Map<String,String> paramsMap = new TreeMap<String,String>();
	if (!CollectionUtils.isEmpty(params)) for (TermParameterDefinition param : params) {
		if (StringUtils.isBlank(param.getName())) { 
			throw new RepositoryDataException("TermParameterDefinition.name may not be blank"); 
		}
		paramsMap.put(param.getName(), param.getValue());
	}
	
	return new Term(termSpecificationDefinition.getName(), paramsMap);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:SimplePropositionTypeService.java

示例11: createTermDefinition

import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入依赖的package包/类
private TermDefinition createTermDefinition(String termName, Class termValueType, ContextDefinition contextDefinition) {

        // this may be called more than once, we only want to create one though
        Map<String, String> queryArgs = new HashMap<String, String>();
        queryArgs.put("specification.namespace", contextDefinition.getNamespace());
        queryArgs.put("specification.name", termName);
        TermBo termBo = getBoService().findByPrimaryKey(TermBo.class, queryArgs);
        if (termBo != null) {
            return TermBo.to(termBo);
        }

        // campusCode TermSpec
        TermSpecificationDefinition termSpec =
            TermSpecificationDefinition.Builder.create(null, termName, contextDefinition.getNamespace(),
                    termValueType.getCanonicalName()).build();

        termSpec = termBoService.createTermSpecification(termSpec);

        // Term 1
        TermDefinition termDefinition =
            TermDefinition.Builder.create(null, TermSpecificationDefinition.Builder.create(termSpec), null).build();
        termDefinition = termBoService.createTerm(termDefinition);

        return termDefinition;
    }
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:26,代码来源:AbstractAgendaBoTest.java

示例12: getTerm

import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krms.impl.repository.TermBoService#getTerm(java.lang.String)
 */
@Override
public TermDefinition getTerm(String id) {
	TermDefinition result = null;
	
	if (StringUtils.isBlank(id)) {
		throw new RiceIllegalArgumentException("id must not be blank or null");
	}
	TermBo termBo = businessObjectService.findBySinglePrimaryKey(TermBo.class, id);
	
	if (termBo != null) {
		result= TermBo.to(termBo);
	}
	
	return result;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:19,代码来源:TermBoServiceImpl.java

示例13: createTermDefinition

import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入依赖的package包/类
protected TermDefinition createTermDefinition(String termName, Class termValueType, ContextDefinition contextDefinition) {

        // this may be called more than once, we only want to create one though
        Map<String, String> queryArgs = new HashMap<String, String>();
        queryArgs.put("specification.namespace", contextDefinition.getNamespace());
        queryArgs.put("specification.name", termName);
        QueryResults<TermBo> queryResults = getDataObjectService().findMatching(TermBo.class,
                QueryByCriteria.Builder.andAttributes(queryArgs).build());

        if (!CollectionUtils.isEmpty(queryResults.getResults())) {
            return TermBo.to(queryResults.getResults().get(0));
        }

        // campusCode TermSpec
        TermSpecificationDefinition termSpec =
            TermSpecificationDefinition.Builder.create(null, termName, contextDefinition.getNamespace(),
                    termValueType.getCanonicalName()).build();

        termSpec = termBoService.createTermSpecification(termSpec);

        // Term 1
        TermDefinition termDefinition =
            TermDefinition.Builder.create(null, TermSpecificationDefinition.Builder.create(termSpec), null).build();
        termDefinition = termBoService.createTerm(termDefinition);

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

示例14: createTermDefinition1

import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入依赖的package包/类
private TermDefinition createTermDefinition1(ContextDefinition contextDefinition) {
    // campusCode TermSpec
    TermSpecificationDefinition campusCodeTermSpec =
        TermSpecificationDefinition.Builder.create(null, "campusCodeTermSpec", contextDefinition.getId(),
                "java.lang.String").build();
    campusCodeTermSpec = termBoService.createTermSpecification(campusCodeTermSpec);

    // Term 1
    TermDefinition termDefinition1 =
        TermDefinition.Builder.create(null, TermSpecificationDefinition.Builder.create(campusCodeTermSpec), null).build();
    termDefinition1 = termBoService.createTerm(termDefinition1);

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

示例15: createTermDefinitionInteger

import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入依赖的package包/类
private TermDefinition createTermDefinitionInteger(ContextDefinition contextDefinition) {
    // campusCode TermSpec
    TermSpecificationDefinition termSpec =
        TermSpecificationDefinition.Builder.create(null, TERM_NAME, contextDefinition.getId(),
                "java.lang.Integer").build();
    termSpec = termBoService.createTermSpecification(termSpec);

    // Term 1
    TermDefinition termDefinition1 =
        TermDefinition.Builder.create(null, TermSpecificationDefinition.Builder.create(termSpec), null).build();
    termDefinition1 = termBoService.createTerm(termDefinition1);

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


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