@Test public void convertStatusCompleted() { final QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse(); questionnaireResponse.setStatus( QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED ); Assert.assertEquals( EventStatus.COMPLETED, transformer.convertStatus( questionnaireResponse ) ); }
@Nonnull protected EventStatus convertStatus( @Nonnull QuestionnaireResponse questionnaireResponse ) { try { final EventStatus eventStatus = EventStatusExtensionUtils.getValue( questionnaireResponse ); if ( eventStatus != null ) { return eventStatus; } } catch ( IllegalArgumentException e ) { throw new TransformerDataException( e.getMessage() ); } final QuestionnaireResponseStatus questionnaireResponseStatus = questionnaireResponse.getStatus(); if ( questionnaireResponseStatus == null ) { throw new TransformerDataException( "No questionnaire response status has been given." ); } switch ( questionnaireResponseStatus ) { case COMPLETED: return EventStatus.COMPLETED; case INPROGRESS: return EventStatus.ACTIVE; default: throw new TransformerDataException( "Questionnaire response status is not allowed: " + questionnaireResponseStatus ); } }
R4FhirQuestionnaireResponseToProgramStageTransformer extends AbstractFhirQuestionnaireResponseToProgramStageTransformer { @Nonnull protected EventStatus convertStatus( @Nonnull QuestionnaireResponse questionnaireResponse ) { try { final EventStatus eventStatus = EventStatusExtensionUtils.getValue( questionnaireResponse ); if ( eventStatus != null ) { return eventStatus; } } catch ( IllegalArgumentException e ) { throw new TransformerDataException( e.getMessage() ); } final QuestionnaireResponseStatus questionnaireResponseStatus = questionnaireResponse.getStatus(); if ( questionnaireResponseStatus == null ) { throw new TransformerDataException( "No questionnaire response status has been given." ); } switch ( questionnaireResponseStatus ) { case COMPLETED: return EventStatus.COMPLETED; case INPROGRESS: return EventStatus.ACTIVE; default: throw new TransformerDataException( "Questionnaire response status is not allowed: " + questionnaireResponseStatus ); } } }
R4FhirQuestionnaireResponseToProgramStageTransformer extends AbstractFhirQuestionnaireResponseToProgramStageTransformer { @Nonnull protected EventStatus convertStatus( @Nonnull QuestionnaireResponse questionnaireResponse ) { try { final EventStatus eventStatus = EventStatusExtensionUtils.getValue( questionnaireResponse ); if ( eventStatus != null ) { return eventStatus; } } catch ( IllegalArgumentException e ) { throw new TransformerDataException( e.getMessage() ); } final QuestionnaireResponseStatus questionnaireResponseStatus = questionnaireResponse.getStatus(); if ( questionnaireResponseStatus == null ) { throw new TransformerDataException( "No questionnaire response status has been given." ); } switch ( questionnaireResponseStatus ) { case COMPLETED: return EventStatus.COMPLETED; case INPROGRESS: return EventStatus.ACTIVE; default: throw new TransformerDataException( "Questionnaire response status is not allowed: " + questionnaireResponseStatus ); } } R4FhirQuestionnaireResponseToProgramStageTransformer( @Nonnull ScriptExecutor scriptExecutor, @Nonnull TrackedEntityMetadataService trackedEntityMetadataService, @Nonnull TrackedEntityService trackedEntityService,
        @Nonnull TrackedEntityRuleRepository trackedEntityRuleRepository, @Nonnull OrganizationUnitService organizationUnitService, @Nonnull ProgramMetadataService programMetadataService, @Nonnull ProgramStageMetadataService programStageMetadataService,
        @Nonnull EventService eventService, @Nonnull FhirResourceMappingRepository resourceMappingRepository, @Nonnull FhirDhisAssignmentRepository fhirDhisAssignmentRepository, @Nonnull ScriptExecutionContext scriptExecutionContext,
        @Nonnull ValueConverter valueConverter ); }
R4FhirQuestionnaireResponseToProgramStageTransformer extends AbstractFhirQuestionnaireResponseToProgramStageTransformer { @Nonnull protected EventStatus convertStatus( @Nonnull QuestionnaireResponse questionnaireResponse ) { try { final EventStatus eventStatus = EventStatusExtensionUtils.getValue( questionnaireResponse ); if ( eventStatus != null ) { return eventStatus; } } catch ( IllegalArgumentException e ) { throw new TransformerDataException( e.getMessage() ); } final QuestionnaireResponseStatus questionnaireResponseStatus = questionnaireResponse.getStatus(); if ( questionnaireResponseStatus == null ) { throw new TransformerDataException( "No questionnaire response status has been given." ); } switch ( questionnaireResponseStatus ) { case COMPLETED: return EventStatus.COMPLETED; case INPROGRESS: return EventStatus.ACTIVE; default: throw new TransformerDataException( "Questionnaire response status is not allowed: " + questionnaireResponseStatus ); } } R4FhirQuestionnaireResponseToProgramStageTransformer( @Nonnull ScriptExecutor scriptExecutor, @Nonnull TrackedEntityMetadataService trackedEntityMetadataService, @Nonnull TrackedEntityService trackedEntityService,
        @Nonnull TrackedEntityRuleRepository trackedEntityRuleRepository, @Nonnull OrganizationUnitService organizationUnitService, @Nonnull ProgramMetadataService programMetadataService, @Nonnull ProgramStageMetadataService programStageMetadataService,
        @Nonnull EventService eventService, @Nonnull FhirResourceMappingRepository resourceMappingRepository, @Nonnull FhirDhisAssignmentRepository fhirDhisAssignmentRepository, @Nonnull ScriptExecutionContext scriptExecutionContext,
        @Nonnull ValueConverter valueConverter ); @Nonnull @Override Set<FhirVersion> getFhirVersions(); }
R4FhirQuestionnaireResponseToProgramStageTransformer extends AbstractFhirQuestionnaireResponseToProgramStageTransformer { @Nonnull protected EventStatus convertStatus( @Nonnull QuestionnaireResponse questionnaireResponse ) { try { final EventStatus eventStatus = EventStatusExtensionUtils.getValue( questionnaireResponse ); if ( eventStatus != null ) { return eventStatus; } } catch ( IllegalArgumentException e ) { throw new TransformerDataException( e.getMessage() ); } final QuestionnaireResponseStatus questionnaireResponseStatus = questionnaireResponse.getStatus(); if ( questionnaireResponseStatus == null ) { throw new TransformerDataException( "No questionnaire response status has been given." ); } switch ( questionnaireResponseStatus ) { case COMPLETED: return EventStatus.COMPLETED; case INPROGRESS: return EventStatus.ACTIVE; default: throw new TransformerDataException( "Questionnaire response status is not allowed: " + questionnaireResponseStatus ); } } R4FhirQuestionnaireResponseToProgramStageTransformer( @Nonnull ScriptExecutor scriptExecutor, @Nonnull TrackedEntityMetadataService trackedEntityMetadataService, @Nonnull TrackedEntityService trackedEntityService,
        @Nonnull TrackedEntityRuleRepository trackedEntityRuleRepository, @Nonnull OrganizationUnitService organizationUnitService, @Nonnull ProgramMetadataService programMetadataService, @Nonnull ProgramStageMetadataService programStageMetadataService,
        @Nonnull EventService eventService, @Nonnull FhirResourceMappingRepository resourceMappingRepository, @Nonnull FhirDhisAssignmentRepository fhirDhisAssignmentRepository, @Nonnull ScriptExecutionContext scriptExecutionContext,
        @Nonnull ValueConverter valueConverter ); @Nonnull @Override Set<FhirVersion> getFhirVersions();  }