Search in sources :

Example 1 with OurTaskUpdateBundleFactory

use of org.hl7.gravity.refimpl.sdohexchange.fhir.factory.OurTaskUpdateBundleFactory in project Gravity-SDOH-Exchange-RI by FHIR.

the class OurTaskService method update.

public void update(String id, UpdateOurTaskRequestDto update, UserDto user) {
    Bundle taskBundle = taskRepository.find(id, Lists.newArrayList(Task.INCLUDE_FOCUS));
    TaskInfoHolder taskInfo = new TaskInfoBundleExtractor().extract(taskBundle).stream().findFirst().orElseThrow(() -> new ResourceNotFoundException(new IdType(Task.class.getSimpleName(), id)));
    OurTaskUpdateBundleFactory bundleFactory = new OurTaskUpdateBundleFactory();
    bundleFactory.setTask(taskInfo.getTask());
    bundleFactory.setServiceRequest(taskInfo.getServiceRequest());
    bundleFactory.setStatus(update.getTaskStatus());
    bundleFactory.setStatusReason(update.getStatusReason());
    bundleFactory.setComment(update.getComment());
    bundleFactory.setUser(user);
    taskRepository.transaction(bundleFactory.createUpdateBundle());
}
Also used : TaskInfoHolder(org.hl7.gravity.refimpl.sdohexchange.fhir.extract.TaskInfoBundleExtractor.TaskInfoHolder) Task(org.hl7.fhir.r4.model.Task) OurTaskUpdateBundleFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.factory.OurTaskUpdateBundleFactory) Bundle(org.hl7.fhir.r4.model.Bundle) TaskInfoBundleExtractor(org.hl7.gravity.refimpl.sdohexchange.fhir.extract.TaskInfoBundleExtractor) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) IdType(org.hl7.fhir.r4.model.IdType)

Aggregations

ResourceNotFoundException (ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)1 Bundle (org.hl7.fhir.r4.model.Bundle)1 IdType (org.hl7.fhir.r4.model.IdType)1 Task (org.hl7.fhir.r4.model.Task)1 TaskInfoBundleExtractor (org.hl7.gravity.refimpl.sdohexchange.fhir.extract.TaskInfoBundleExtractor)1 TaskInfoHolder (org.hl7.gravity.refimpl.sdohexchange.fhir.extract.TaskInfoBundleExtractor.TaskInfoHolder)1 OurTaskUpdateBundleFactory (org.hl7.gravity.refimpl.sdohexchange.fhir.factory.OurTaskUpdateBundleFactory)1