use of com.khartec.waltz.model.survey.SurveyQuestionResponse in project waltz by khartec.
the class SurveyQuestionResponseDao method mkRecord.
private SurveyQuestionResponseRecord mkRecord(SurveyInstanceQuestionResponse response) {
SurveyQuestionResponse questionResponse = response.questionResponse();
Optional<EntityReference> entityResponse = questionResponse.entityResponse();
SurveyQuestionResponseRecord record = dsl.newRecord(SURVEY_QUESTION_RESPONSE);
record.setSurveyInstanceId(response.surveyInstanceId());
record.setQuestionId(questionResponse.questionId());
record.setPersonId(response.personId());
record.setLastUpdatedAt(Timestamp.valueOf(response.lastUpdatedAt()));
record.setComment(questionResponse.comment().map(c -> ifEmpty(c, null)).orElse(null));
record.setStringResponse(questionResponse.stringResponse().map(s -> ifEmpty(s, null)).orElse(null));
record.setNumberResponse(questionResponse.numberResponse().map(BigDecimal::valueOf).orElse(null));
record.setBooleanResponse(questionResponse.booleanResponse().orElse(null));
record.setDateResponse(questionResponse.dateResponse().map(DateTimeUtilities::toSqlDate).orElse(null));
record.setEntityResponseKind(entityResponse.map(er -> er.kind().name()).orElse(null));
record.setEntityResponseId(entityResponse.map(er -> er.id()).orElse(null));
return record;
}
Aggregations