use of com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSet in project snow-owl by b2ihealthcare.
the class SnomedRefSetMemberCreateRequest method getRefSet.
private SnomedReferenceSet getRefSet(TransactionContext context) {
final SnomedReferenceSet refSet = new SnomedReferenceSetConverter(context, Options.builder().build(), Collections.emptyList()).convert(context.lookup(referenceSetId, SnomedConceptDocument.class));
checkArgument(refSet.getType() != null, "Reference Set Properties are missing from identifier concept document: %s.", refSet.getId());
return refSet;
}
use of com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSet in project snow-owl by b2ihealthcare.
the class SnomedRefSetMemberCreateRequest method getRequiredComponentIds.
/**
* @return the set of core component SCTIDs mentioned in any reference set member property
*/
@Override
public Set<String> getRequiredComponentIds(TransactionContext context) {
try {
SnomedReferenceSet refSet = getRefSet(context);
SnomedRefSetMemberCreateDelegate delegate = getDelegate(refSet.getType());
Builder<String> requiredComponentIds = ImmutableSet.<String>builder().addAll(delegate.getRequiredComponentIds());
requiredComponentIds.add(referenceSetId);
if (!Strings.isNullOrEmpty(referencedComponentId)) {
requiredComponentIds.add(referencedComponentId);
}
if (!Strings.isNullOrEmpty(moduleId)) {
requiredComponentIds.add(moduleId);
}
return requiredComponentIds.build();
} catch (ComponentNotFoundException e) {
throw e.toBadRequestException();
}
}
use of com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSet in project snow-owl by b2ihealthcare.
the class SnomedRefSetMemberCreateRequest method execute.
@Override
public String execute(TransactionContext context) {
/*
* TODO: Generalize the logic below: any attempts of retrieving a missing component during component creation
* should return a 400 response instead of a 404.
*/
try {
SnomedReferenceSet refSet = getRefSet(context);
SnomedRefSetMemberCreateDelegate delegate = getDelegate(refSet.getType());
return delegate.execute(refSet, context);
} catch (ComponentNotFoundException e) {
throw e.toBadRequestException();
}
}
use of com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSet in project snow-owl by b2ihealthcare.
the class SnomedDSVExportRequest method getRefSetExporter.
private IRefSetDSVExporter getRefSetExporter(BranchContext context) {
final SnomedReferenceSet refSet = SnomedRequests.prepareGetReferenceSet(refSetId).build().execute(context);
IRefSetDSVExporter exporter = null;
if (SnomedRefSetType.SIMPLE.equals(refSet.getType())) {
exporter = new SnomedSimpleTypeRefSetDSVExporter(context, toExportModel(context));
} else if (SnomedRefSetUtil.isMapping(refSet.getType())) {
exporter = new MapTypeRefSetDSVExporter(context, toExportModel(context));
} else {
throw new BadRequestException("Unsupported reference set '%s' with type '%s' in DSV export", refSetId, refSet.getType());
}
return exporter;
}
Aggregations