Search in sources :

Example 1 with CmsNSReferral

use of gov.ca.cwds.rest.api.domain.cms.CmsNSReferral in project API by ca-cwds.

the class CmsNSReferralService method create.

/**
   * {@inheritDoc}
   * 
   * @see gov.ca.cwds.rest.services.CrudsService#create(gov.ca.cwds.rest.api.Request)
   */
@Override
public Response create(Request request) {
    assert request instanceof CmsReferral;
    CmsNSReferral cmsReferral = (CmsNSReferral) request;
    CmsNSHelper helper = new CmsNSHelper(cmsSessionFactory, nsSessionFactory);
    Map<CrudsService, Request> cmsRequest = new HashMap<>();
    Map<CrudsService, Request> nsRequest = new HashMap<>();
    cmsRequest.put(referralService, cmsReferral.getReferral());
    nsRequest.put(personService, cmsReferral.getPerson());
    Map<String, Map<CrudsService, Response>> response = helper.handleResponse(cmsRequest, nsRequest);
    return new PostedCmsNSReferral((PostedReferral) response.get("cms").get(referralService), (PostedPerson) response.get("ns").get(personService));
}
Also used : CmsReferral(gov.ca.cwds.rest.api.domain.cms.CmsReferral) PostedCmsNSReferral(gov.ca.cwds.rest.api.domain.cms.PostedCmsNSReferral) HashMap(java.util.HashMap) CrudsService(gov.ca.cwds.rest.services.CrudsService) CmsNSReferral(gov.ca.cwds.rest.api.domain.cms.CmsNSReferral) PostedCmsNSReferral(gov.ca.cwds.rest.api.domain.cms.PostedCmsNSReferral) Request(gov.ca.cwds.rest.api.Request) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

Request (gov.ca.cwds.rest.api.Request)1 CmsNSReferral (gov.ca.cwds.rest.api.domain.cms.CmsNSReferral)1 CmsReferral (gov.ca.cwds.rest.api.domain.cms.CmsReferral)1 PostedCmsNSReferral (gov.ca.cwds.rest.api.domain.cms.PostedCmsNSReferral)1 CrudsService (gov.ca.cwds.rest.services.CrudsService)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1