use of gov.ca.cwds.rest.api.domain.PostedScreeningToReferral in project API by ca-cwds.
the class ScreeningToReferralService method create.
@UnitOfWork(value = "cms")
@Override
public Response create(Request request) {
ScreeningToReferral screeningToReferral = (ScreeningToReferral) request;
Set<ErrorMessage> messages = new HashSet<ErrorMessage>();
verifyReferralHasValidParticipants(screeningToReferral, messages);
String dateStarted = extractStartDate(screeningToReferral, messages);
String timeStarted = extractStartTime(screeningToReferral, messages);
String referralId = createCmsReferral(screeningToReferral, messages, dateStarted, timeStarted);
createReferralAddress(screeningToReferral, messages);
Set<Participant> resultParticipants = new HashSet<>();
HashMap<Long, String> victimClient = new HashMap<>();
HashMap<Long, String> perpatratorClient = new HashMap<>();
processParticipants(screeningToReferral, messages, dateStarted, referralId, resultParticipants, victimClient, perpatratorClient);
Set<CrossReport> resultCrossReports = createCrossReports(screeningToReferral, messages, referralId);
Set<Allegation> resultAllegations = createAllegations(screeningToReferral, messages, referralId, victimClient, perpatratorClient);
PostedScreeningToReferral pstr = PostedScreeningToReferral.createWithDefaults(referralId, screeningToReferral, resultParticipants, resultCrossReports, resultAllegations);
pstr.setMessages(messages);
return pstr;
}
Aggregations