use of se.inera.intyg.webcert.persistence.arende.model.ArendeDraft in project webcert by sklintyg.
the class ArendeDraftServiceImpl method createDraft.
private ArendeDraft createDraft(String intygId, String questionId, String text, String amne) {
ArendeDraft draft;
draft = new ArendeDraft();
draft.setIntygId(intygId);
draft.setQuestionId(questionId);
draft.setText(text);
draft.setAmne(amne);
return draft;
}
use of se.inera.intyg.webcert.persistence.arende.model.ArendeDraft in project webcert by sklintyg.
the class ArendeDraftServiceImpl method saveDraft.
@Override
public boolean saveDraft(String intygId, String questionId, String text, String amne) {
ArendeDraft draft = arendeDraftRepository.findByIntygIdAndQuestionId(intygId, questionId);
if (draft != null) {
draft.setText(text);
draft.setAmne(amne);
} else {
draft = createDraft(intygId, questionId, text, amne);
}
arendeDraftRepository.save(draft);
return true;
}
use of se.inera.intyg.webcert.persistence.arende.model.ArendeDraft in project webcert by sklintyg.
the class ArendeDraftRepositoryTest method buildArendeDraft.
private ArendeDraft buildArendeDraft(String intygId, String questionId) {
ArendeDraft arendeDraft = new ArendeDraft();
arendeDraft.setQuestionId(questionId);
arendeDraft.setIntygId(intygId);
return arendeDraft;
}
use of se.inera.intyg.webcert.persistence.arende.model.ArendeDraft in project webcert by sklintyg.
the class FragaSvarServiceImplTest method buildArendeDraft.
private ArendeDraft buildArendeDraft(String intygId, String questionId, String text) {
ArendeDraft draft = new ArendeDraft();
draft.setIntygId(intygId);
draft.setQuestionId(questionId);
draft.setText(text);
return draft;
}
use of se.inera.intyg.webcert.persistence.arende.model.ArendeDraft in project webcert by sklintyg.
the class ArendeDraftServiceImplTest method testDeleteExisting.
@Test
public void testDeleteExisting() {
final String intygId = "intygId";
final String questionId = "questionId";
ArendeDraft draft = buildArendeDraft(intygId, questionId, null, null);
when(repo.findByIntygIdAndQuestionId(intygId, questionId)).thenReturn(draft);
boolean res = arendeDraftService.delete(intygId, questionId);
assertTrue(res);
verify(repo).findByIntygIdAndQuestionId(intygId, questionId);
verify(repo).delete(draft);
verifyNoMoreInteractions(repo);
}
Aggregations