use of ca.uhn.fhir.rest.annotation.Create in project elexis-server by elexis.
the class ObservationResourceProvider method createObservation.
@Create
public MethodOutcome createObservation(@ResourceParam Observation observation) {
MethodOutcome outcome = new MethodOutcome();
Optional<IObservation> exists = getTransformer().getLocalObject(observation);
if (exists.isPresent()) {
outcome.setCreated(false);
outcome.setId(new IdType(observation.getId()));
} else {
Optional<IObservation> created = getTransformer().createLocalObject(observation);
if (created.isPresent()) {
outcome.setCreated(true);
outcome.setId(new IdType(created.get().getId()));
} else {
throw new InternalErrorException("Creation failed");
}
}
return outcome;
}
use of ca.uhn.fhir.rest.annotation.Create in project elexis-server by elexis.
the class ServiceRequestResourceProvider method createProcedureRequest.
@Create
public MethodOutcome createProcedureRequest(@ResourceParam ServiceRequest procedureRequest) {
MethodOutcome outcome = new MethodOutcome();
Optional<IProcedureRequest> exists = getTransformer().getLocalObject(procedureRequest);
if (exists.isPresent()) {
outcome.setCreated(false);
outcome.setId(new IdType(procedureRequest.getId()));
} else {
Optional<IProcedureRequest> created = getTransformer().createLocalObject(procedureRequest);
if (created.isPresent()) {
outcome.setCreated(true);
outcome.setId(new IdType(created.get().getId()));
} else {
throw new InternalErrorException("Creation failed");
}
}
return outcome;
}
use of ca.uhn.fhir.rest.annotation.Create in project elexis-server by elexis.
the class AbstractFhirCrudResourceProvider method create.
@Create
public MethodOutcome create(@ResourceParam FHIR fhirObject) {
MethodOutcome outcome = new MethodOutcome();
Optional<ELEXIS> exists = getTransformer().getLocalObject(fhirObject);
if (exists.isPresent()) {
outcome.setCreated(false);
outcome.setId(new IdType(fhirObject.getId()));
} else {
outcome = resourceProviderUtil.createResource(getTransformer(), fhirObject, log);
}
return outcome;
}
use of ca.uhn.fhir.rest.annotation.Create in project elexis-server by elexis.
the class AllergyIntoleranceResourceProvider method createAllergyIntolerance.
@Create
public MethodOutcome createAllergyIntolerance(@ResourceParam AllergyIntolerance allergyIntolerance) {
MethodOutcome outcome = new MethodOutcome();
Optional<IAllergyIntolerance> exists = getTransformer().getLocalObject(allergyIntolerance);
if (exists.isPresent()) {
outcome.setCreated(false);
outcome.setId(new IdType(allergyIntolerance.getId()));
} else {
Optional<IAllergyIntolerance> created = getTransformer().createLocalObject(allergyIntolerance);
if (created.isPresent()) {
outcome.setCreated(true);
outcome.setId(new IdType(created.get().getId()));
} else {
throw new InternalErrorException("Creation failed");
}
}
return outcome;
}
use of ca.uhn.fhir.rest.annotation.Create in project elexis-server by elexis.
the class ConditionResourceProvider method createCondition.
@Create
public MethodOutcome createCondition(@ResourceParam Condition condition) {
MethodOutcome outcome = new MethodOutcome();
Optional<ICondition> exists = getTransformer().getLocalObject(condition);
if (exists.isPresent()) {
outcome.setCreated(false);
outcome.setId(new IdType(condition.getId()));
} else {
Optional<ICondition> created = getTransformer().createLocalObject(condition);
if (created.isPresent()) {
outcome.setCreated(true);
outcome.setId(new IdType(created.get().getId()));
} else {
throw new InternalErrorException("Creation failed");
}
}
return outcome;
}
Aggregations