本文整理汇总了Java中org.kuali.rice.krms.api.repository.term.TermDefinition.getId方法的典型用法代码示例。如果您正苦于以下问题:Java TermDefinition.getId方法的具体用法?Java TermDefinition.getId怎么用?Java TermDefinition.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.krms.api.repository.term.TermDefinition
的用法示例。
在下文中一共展示了TermDefinition.getId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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);
}
示例4: updateTerm
import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入方法依赖的package包/类
@Override
public void updateTerm(TermDefinition termDef) throws RiceIllegalArgumentException {
TermDefinition existing = this.getTerm(termDef.getId());
if (existing == null) {
throw new RiceIllegalArgumentException(termDef.getId() + " does not exist");
}
this.termMap.put(termDef.getId(), termDef);
}
示例5: createProposition
import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入方法依赖的package包/类
@Override
public PropositionDefinition createProposition(PropositionDefinition propositionDefinition)
throws RiceIllegalArgumentException {
// CREATE
if (propositionDefinition.getId() != null) {
PropositionDefinition orig = this.getProposition(propositionDefinition.getId());
if (orig != null) {
throw new RiceIllegalArgumentException(propositionDefinition.getId());
}
}
PropositionDefinition.Builder copy = PropositionDefinition.Builder.create(propositionDefinition);
if (copy.getId() == null) {
copy.setId(UUID.randomUUID().toString());
}
for (PropositionParameter.Builder paramBldr : copy.getParameters()) {
if (paramBldr.getId() == null) {
paramBldr.setId(UUID.randomUUID().toString());
}
if (paramBldr.getPropId() == null) {
paramBldr.setPropId(copy.getId());
}
if (paramBldr.getTermValue() != null) {
TermDefinition termValue = paramBldr.getTermValue();
// no id means it does not exist yet
if (termValue.getId() == null) {
termValue = this.termRepositoryService.createTerm(termValue);
paramBldr.setTermValue(termValue);
}
if (paramBldr.getValue() == null) {
paramBldr.setValue(termValue.getId());
}
}
}
propositionDefinition = copy.build();
propositionMap.put(propositionDefinition.getId(), propositionDefinition);
return propositionDefinition;
}
示例6: updateProposition
import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入方法依赖的package包/类
@Override
public void updateProposition(PropositionDefinition propositionDefinition)
throws RiceIllegalArgumentException {
if (this.propositionMap.containsKey(propositionDefinition.getId())) {
throw new RiceIllegalArgumentException (propositionDefinition.getId() + "not found");
}
// UPDATE
PropositionDefinition.Builder copy = PropositionDefinition.Builder.create(propositionDefinition);
PropositionDefinition old = this.getProposition(propositionDefinition.getId());
if (!old.getVersionNumber().equals(copy.getVersionNumber())) {
throw new RiceIllegalStateException("" + old.getVersionNumber());
}
copy.setVersionNumber(copy.getVersionNumber() + 1);
for (PropositionParameter.Builder paramBldr : copy.getParameters()) {
if (paramBldr.getId() == null) {
paramBldr.setId(UUID.randomUUID().toString());
}
if (paramBldr.getPropId() == null) {
paramBldr.setPropId(copy.getId());
}
if (paramBldr.getTermValue() != null) {
TermDefinition termValue = paramBldr.getTermValue();
// no id means it does not exist yet
if (termValue.getId() == null) {
termValue = this.termRepositoryService.createTerm(termValue);
paramBldr.setTermValue(termValue);
}
if (paramBldr.getValue() == null) {
paramBldr.setValue(termValue.getId());
}
}
}
propositionDefinition = copy.build();
this.propositionMap.put(propositionDefinition.getId(), propositionDefinition);
return;
}
示例7: updateTerm
import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入方法依赖的package包/类
@Override
public void updateTerm(TermDefinition term) throws RiceIllegalArgumentException {
if (term == null) {
throw new IllegalArgumentException("term is null");
}
// must already exist to be able to update
final String termId = term.getId();
final TermBo existing = getDataObjectService().find(TermBo.class, termId);
if (existing == null) {
throw new IllegalStateException("the term resolver does not exist: " + term);
}
final TermDefinition toUpdate;
if (!existing.getId().equals(term.getId())) {
// if passed in id does not match existing id, correct it
final TermDefinition.Builder builder = TermDefinition.Builder.create(term);
builder.setId(existing.getId());
toUpdate = builder.build();
} else {
toUpdate = term;
}
// copy all updateable fields to bo
TermBo boToUpdate = TermBo.from(toUpdate);
// update the rule and create new attributes
getDataObjectService().save(boToUpdate, PersistenceOption.FLUSH);
}
示例8: setTermValue
import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入方法依赖的package包/类
public void setTermValue(TermDefinition termValue) {
if (termValue != null) {
value = termValue.getId();
}
this.termValue = termValue;
}
示例9: createPropositionDefinition1
import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入方法依赖的package包/类
private PropositionDefinition createPropositionDefinition1(String contextId, String ruleId){
String namespace = KrmsConstants.KRMS_NAMESPACE;
String propId = null;
String propConstant = "BL";
TermDefinition termDefinition = createTermDefinition1(contextId);
String termSpecId = termDefinition.getId();
String termSpecType = termDefinition.getSpecification().getType();
String termSpecDescr = termDefinition.getSpecification().getDescription();
createTestTermSpecification(termSpecId, termSpecId, namespace, termSpecType, termSpecDescr);
KrmsTypeDefinition krmsTypeDefinition = createKrmsTypeDefinition(null, namespace, termSpecId, "testTypeService");
PropositionDefinition.Builder propBuilder = PropositionDefinition.Builder.create(propId,
PropositionType.SIMPLE.getCode(), ruleId, null, Collections.<PropositionParameter.Builder>emptyList());
propBuilder.setDescription("is campus bloomington");
PropositionDefinition propositionDefinition = ruleManagementService.createProposition(propBuilder.build());
List<PropositionParameter.Builder> propParam = new ArrayList<PropositionParameter.Builder>();
propParam.add(PropositionParameter.Builder.create(propId + "_0", propositionDefinition.getId(), termSpecId,
PropositionParameterType.TERM.getCode(), 0));
propParam.add(PropositionParameter.Builder.create(propId + "_1", propositionDefinition.getId(), propConstant,
PropositionParameterType.CONSTANT.getCode(), 1));
propParam.add(PropositionParameter.Builder.create(propId + "_2", propositionDefinition.getId(), propOperator,
PropositionParameterType.OPERATOR.getCode(), 2));
propBuilder = PropositionDefinition.Builder.create(propositionDefinition);
propBuilder.setParameters(propParam);
ruleManagementService.updateProposition(propBuilder.build());
// re-fetch to get the updated version numbers
propositionDefinition = ruleManagementService.getProposition(propositionDefinition.getId());
return propositionDefinition;
}
示例10: maintainTermValues
import org.kuali.rice.krms.api.repository.term.TermDefinition; //导入方法依赖的package包/类
private PropositionDefinition.Builder maintainTermValues(PropositionDefinition.Builder propBldr) {
if (propBldr.getParameters() == null) {
return propBldr;
}
if (propBldr.getParameters().isEmpty()) {
return propBldr;
}
boolean updated = false;
List<PropositionParameter.Builder> paramBldrs = new ArrayList<PropositionParameter.Builder> ();
for (PropositionParameter.Builder paramBldr : propBldr.getParameters()) {
paramBldrs.add(paramBldr);
// link the param the proposition's id
// not sure we need to do this but...
if (paramBldr.getPropId() == null) {
paramBldr.setPropId(propBldr.getId());
updated = true;
}
// create the termvalue if it was specified
if (paramBldr.getTermValue() != null) {
TermDefinition termValue = paramBldr.getTermValue();
// no id means it does not exist yet
if (termValue.getId() == null) {
termValue = this.termRepositoryService.createTerm(termValue);
paramBldr.setTermValue(termValue);
updated = true;
} else {
this.termRepositoryService.updateTerm(termValue);
}
if ((paramBldr.getValue() == null) || (!paramBldr.getValue().equals(termValue.getId()))) {
paramBldr.setValue(termValue.getId());
updated = true;
}
}
}
if (!updated) {
return propBldr;
}
propBldr.setParameters(paramBldrs);
return propBldr;
}