use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskTranslatorImplTest method toFhirResource_shouldTranslateInputTextValue.
// Task.input
@Test
public void toFhirResource_shouldTranslateInputTextValue() {
FhirTask task = new FhirTask();
FhirTaskInput input = new FhirTaskInput();
String inputVal = "some input value";
Concept inputType = new Concept();
inputType.setUuid(CONCEPT_UUID);
input.setType(inputType);
input.setValueText(inputVal);
task.setInput(Collections.singleton(input));
when(conceptTranslator.toFhirResource(inputType)).thenReturn(new CodeableConcept().setCoding(Collections.singletonList(new Coding().setCode(CONCEPT_UUID))));
Task result = taskTranslator.toFhirResource(task);
assertThat(result, notNullValue());
assertThat(result.getInput(), hasSize(1));
assertThat(result.getInput().iterator().next().getType().getCoding().iterator().next().getCode(), equalTo(CONCEPT_UUID));
assertThat(result.getInput().iterator().next().getValue().toString(), equalTo(inputVal));
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class FhirTaskTranslatorImplTest method toFhirResource_shouldTranslateIntent.
// Task.intent
@Test
public void toFhirResource_shouldTranslateIntent() {
FhirTask task = new FhirTask();
task.setIntent(OPENMRS_TASK_INTENT);
Task result = taskTranslator.toFhirResource(task);
assertThat(result, notNullValue());
assertThat(result.getIntent(), equalTo(FHIR_TASK_INTENT));
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class ProvenanceTranslatorImplTest method initDummyObjects.
@Before
public void initDummyObjects() {
user = new User();
user.setUuid(USER_UUID);
person = new Person();
person.setUuid(PERSON_UUID);
person.setGender(GENDER);
person.setCreator(user);
person.setDateCreated(new Date());
person.setChangedBy(user);
person.setDateChanged(new Date());
task = new FhirTask();
task.setUuid(TASK_UUID);
task.setCreator(user);
task.setDateCreated(new Date());
task.setChangedBy(user);
task.setDateChanged(new Date());
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class TaskTranslatorImpl method toFhirResource.
@Override
public Task toFhirResource(@Nonnull FhirTask openmrsTask) {
notNull(openmrsTask, "The openmrsTask object should not be null");
Task fhirTask = new Task();
setFhirTaskFields(openmrsTask, fhirTask);
fhirTask.addContained(provenanceTranslator.getCreateProvenance(openmrsTask));
fhirTask.addContained(provenanceTranslator.getUpdateProvenance(openmrsTask));
return fhirTask;
}
use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.
the class TaskTranslatorImpl method toOpenmrsType.
@Override
public FhirTask toOpenmrsType(@Nonnull Task fhirTask) {
notNull(fhirTask, "The Task object should not be null");
FhirTask openmrsTask = new FhirTask();
setOpenmrsTaskFields(openmrsTask, fhirTask);
return openmrsTask;
}
Aggregations