java 调用cab_Java RefexCAB.put方法代码示例

import org.ihtsdo.otf.tcc.api.blueprint.RefexCAB; //导入方法依赖的package包/类

/**

* Create a concept in the DB, for the specified user. Only call this if {@link #alreadyExists(User)) return false

*/

public static void createUserConcept(User user) throws IOException, InvalidCAB, ContradictionException

{

logger.info("Creating user " + toString(user) + " in DB");

AppContext.getRuntimeGlobals().disableAllCommitListeners();

try

{

BdbTerminologyStore ts = ExtendedAppContext.getDataStore();

String fsn = user.getUniqueFullName();

String preferredName = user.getFullName();

String logonName = user.getUniqueLogonName();

UUID userUUID = UUID.fromString(user.getUUID());

LanguageCode lc = LanguageCode.EN_US;

UUID isA = Snomed.IS_A.getUuids()[0];

IdDirective idDir = IdDirective.PRESERVE_CONCEPT_REST_HASH;

UUID module = TermAux.TERM_AUX_MODULE.getUuids()[0];

UUID parents[] = new UUID[] { TermAux.USER.getUuids()[0] };

ConceptCB cab = new ConceptCB(fsn, preferredName, lc, isA, idDir, module, userUUID, parents);

DescriptionCAB dCab = new DescriptionCAB(cab.getComponentUuid(), Snomed.SYNONYM_DESCRIPTION_TYPE.getUuids()[0], lc, logonName, true,

IdDirective.GENERATE_HASH);

dCab.getProperties().put(ComponentProperty.MODULE_ID, module);

//Mark it as acceptable

RefexCAB rCabAcceptable = new RefexCAB(RefexType.CID, dCab.getComponentUuid(), Snomed.US_LANGUAGE_REFEX.getUuids()[0], IdDirective.GENERATE_HASH,

RefexDirective.EXCLUDE);

rCabAcceptable.put(ComponentProperty.COMPONENT_EXTENSION_1_ID, SnomedMetadataRf2.ACCEPTABLE_RF2.getUuids()[0]);

rCabAcceptable.getProperties().put(ComponentProperty.MODULE_ID, module);

dCab.addAnnotationBlueprint(rCabAcceptable);

cab.addDescriptionCAB(dCab);

//TODO store roles on the concept

//Build this on the lowest level path, otherwise, other code that references this will fail (as it doesn't know about custom paths)

ConceptChronicleBI newCon = ts.getTerminologyBuilder(

new EditCoordinate(TermAux.USER.getLenient().getConceptNid(), TermAux.TERM_AUX_MODULE.getLenient().getNid(), TermAux.WB_AUX_PATH.getLenient()

.getConceptNid()), StandardViewCoordinates.getWbAuxiliary()).construct(cab);

ts.addUncommitted(newCon);

ts.commit(newCon);

}

finally

{

AppContext.getRuntimeGlobals().enableAllCommitListeners();

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值