use of com.b2international.snowowl.core.codesystem.CodeSystem in project snow-owl by b2ihealthcare.
the class CodeSystemResource method configureCodeSystem.
public static void configureCodeSystem(final TestBranchContext.Builder context) {
final List<Map<String, Object>> languageMap = Lists.newArrayList();
languageMap.add(Map.of("languageTag", US_LOCALE.getLanguageTag(), "languageRefSetIds", List.of(Concepts.REFSET_LANGUAGE_TYPE_US)));
languageMap.add(Map.of("languageTag", GB_LOCALE.getLanguageTag(), "languageRefSetIds", List.of(Concepts.REFSET_LANGUAGE_TYPE_UK)));
languageMap.add(Map.of("languageTag", SG_LOCALE.getLanguageTag(), "languageRefSetIds", List.of(Concepts.REFSET_LANGUAGE_TYPE_SG)));
final CodeSystem cs = new CodeSystem();
cs.setBranchPath(Branch.MAIN_PATH);
cs.setId(SnomedContentRule.SNOMEDCT_ID);
cs.setSettings(Map.of(SnomedTerminologyComponentConstants.CODESYSTEM_LANGUAGE_CONFIG_KEY, languageMap));
context.with(TerminologyResource.class, cs);
}
use of com.b2international.snowowl.core.codesystem.CodeSystem in project snow-owl by b2ihealthcare.
the class BaseSnomedEclEvaluationRequestTest method createCodeSystem.
private CodeSystem createCodeSystem(String main) {
CodeSystem codeSystem = new CodeSystem();
codeSystem.setId("SNOMEDCT");
codeSystem.setBranchPath(main);
codeSystem.setSettings(Map.of(SnomedTerminologyComponentConstants.CODESYSTEM_LANGUAGE_CONFIG_KEY, List.of(Map.of("languageTag", "en", "languageRefSetIds", List.of(Concepts.REFSET_LANGUAGE_TYPE_UK, Concepts.REFSET_LANGUAGE_TYPE_US)), Map.of("languageTag", "en-us", "languageRefSetIds", List.of(Concepts.REFSET_LANGUAGE_TYPE_US)), Map.of("languageTag", "en-gb", "languageRefSetIds", List.of(Concepts.REFSET_LANGUAGE_TYPE_UK)))));
return codeSystem;
}
use of com.b2international.snowowl.core.codesystem.CodeSystem in project snow-owl by b2ihealthcare.
the class BaseGenericValidationRuleTest method configureContext.
@Override
protected void configureContext(Builder context) {
super.configureContext(context);
final CodeSystem cs = new CodeSystem();
cs.setBranchPath(MAIN);
cs.setId(CODESYSTEM);
context.with(TerminologyResource.class, cs).with(EclParser.class, new DefaultEclParser(ECL_INJECTOR.getInstance(IParser.class), ECL_INJECTOR.getInstance(IResourceValidator.class))).with(EclSerializer.class, new DefaultEclSerializer(ECL_INJECTOR.getInstance(ISerializer.class)));
}
use of com.b2international.snowowl.core.codesystem.CodeSystem in project snow-owl by b2ihealthcare.
the class CodeSystemRestService method delete.
@Operation(summary = "Delete a CodeSystem", description = "Deletes a CodeSystem permanently from the server")
@ApiResponses({ @ApiResponse(responseCode = "204", description = "No content"), @ApiResponse(responseCode = "400", description = "Bad Request"), @ApiResponse(responseCode = "409", description = "CodeSystem cannot be deleted") })
@DeleteMapping(value = "/{codeSystemId}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void delete(@Parameter(description = "The code system identifier") @PathVariable(value = "codeSystemId") final String codeSystemId, @RequestHeader(value = X_AUTHOR, required = false) final String author) {
try {
final CodeSystem codeSystem = CodeSystemRequests.prepareGetCodeSystem(codeSystemId).buildAsync().execute(getBus()).getSync(1, TimeUnit.MINUTES);
ResourceRequests.prepareDelete(codeSystemId).build(author, String.format("Deleted Code System %s", codeSystem.getTitle())).execute(getBus()).getSync(COMMIT_TIMEOUT, TimeUnit.MINUTES);
} catch (NotFoundException e) {
// already deleted, ignore error
}
}
use of com.b2international.snowowl.core.codesystem.CodeSystem in project snow-owl by b2ihealthcare.
the class CodeSystemUpgradeRestService method upgrade.
@Operation(summary = "Start a Code System dependency upgrade (EXPERIMENTAL)", description = "Starts the upgrade process of a Code System to a newer extensionOf Code System dependency than the current extensionOf.")
@ApiResponses({ @ApiResponse(responseCode = "201", description = "Upgrade created"), @ApiResponse(responseCode = "400", description = "Code System cannot be upgraded") })
@PostMapping(consumes = { AbstractRestService.JSON_MEDIA_TYPE })
@ResponseStatus(HttpStatus.CREATED)
public Promise<ResponseEntity<Void>> upgrade(@RequestBody final UpgradeRestInput body) {
final UriComponentsBuilder uriBuilder = createURIBuilder();
final ResourceURI upgradeOf = new ResourceURI(body.getUpgradeOf());
final IEventBus bus = getBus();
return // TODO move this to generic resource controller
CodeSystemRequests.prepareGetCodeSystem(upgradeOf.getResourceId()).buildAsync().execute(bus).thenWith(codeSystem -> {
return CodeSystemRequests.prepareUpgrade(upgradeOf, new ResourceURI(body.getExtensionOf())).setResourceId(body.getCodeSystemId()).buildAsync().execute(bus);
}).then(upgradeCodeSystemId -> {
return ResponseEntity.created(uriBuilder.pathSegment(upgradeCodeSystemId).build().toUri()).build();
});
}
Aggregations