gt: 		Session session = sessionHelper.getSession(request);
context: package com.servinglynk.hmis.warehouse.rest;
  
  import java.util.UUID;
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.validation.Valid;
  
  import org.springframework.web.bind.annotation.PathVariable;
  import org.springframework.web.bind.annotation.RequestBody;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.RequestParam;
  import org.springframework.web.bind.annotation.RestController;
  
  import com.servinglynk.hmis.warehouse.annotations.APIMapping;
  import com.servinglynk.hmis.warehouse.core.model.Account;
  import com.servinglynk.hmis.warehouse.core.model.Client;
  import com.servinglynk.hmis.warehouse.core.model.Clients;
  import com.servinglynk.hmis.warehouse.core.model.Contact;
  import com.servinglynk.hmis.warehouse.core.model.Contacts;
  import com.servinglynk.hmis.warehouse.core.model.Dateofengagement;
  import com.servinglynk.hmis.warehouse.core.model.Dateofengagements;
  import com.servinglynk.hmis.warehouse.core.model.Disabilities;
  import com.servinglynk.hmis.warehouse.core.model.DisabilitiesList;
  import com.servinglynk.hmis.warehouse.core.model.Domesticviolence;
  import com.servinglynk.hmis.warehouse.core.model.Domesticviolences;
  import com.servinglynk.hmis.warehouse.core.model.Education;
  import com.servinglynk.hmis.warehouse.core.model.Educations;
  import com.servinglynk.hmis.warehouse.core.model.Employment;
  import com.servinglynk.hmis.warehouse.core.model.Employments;
  import com.servinglynk.hmis.warehouse.core.model.Enrollment;
  import com.servinglynk.hmis.warehouse.core.model.EnrollmentCoc;
  import com.servinglynk.hmis.warehouse.core.model.EnrollmentCocs;
  import com.servinglynk.hmis.warehouse.core.model.Enrollments;
  import com.servinglynk.hmis.warehouse.core.model.Entryrhsp;
  import com.servinglynk.hmis.warehouse.core.model.Entryrhsps;
  import com.servinglynk.hmis.warehouse.core.model.Entryrhy;
  import com.servinglynk.hmis.warehouse.core.model.Entryrhys;
  import com.servinglynk.hmis.warehouse.core.model.Entryssvf;
  import com.servinglynk.hmis.warehouse.core.model.Entryssvfs;
  import com.servinglynk.hmis.warehouse.core.model.Exit;
  import com.servinglynk.hmis.warehouse.core.model.Exithousingassessment;
  import com.servinglynk.hmis.warehouse.core.model.Exithousingassessments;
  import com.servinglynk.hmis.warehouse.core.model.Exitpath;
  import com.servinglynk.hmis.warehouse.core.model.Exitpaths;
  import com.servinglynk.hmis.warehouse.core.model.Exitrhy;
  import com.servinglynk.hmis.warehouse.core.model.Exitrhys;
  import com.servinglynk.hmis.warehouse.core.model.Exits;
  import com.servinglynk.hmis.warehouse.core.model.Healthinsurance;
  import com.servinglynk.hmis.warehouse.core.model.Healthinsurances;
  import com.servinglynk.hmis.warehouse.core.model.Healthstatus;
  import com.servinglynk.hmis.warehouse.core.model.Healthstatuses;
  import com.servinglynk.hmis.warehouse.core.model.HousingAssessmentDisposition;
  import com.servinglynk.hmis.warehouse.core.model.HousingAssessmentDispositions;
  import com.servinglynk.hmis.warehouse.core.model.IncomeAndSource;
  import com.servinglynk.hmis.warehouse.core.model.IncomeAndSources;
  import com.servinglynk.hmis.warehouse.core.model.Medicalassistance;
  import com.servinglynk.hmis.warehouse.core.model.Medicalassistances;
  import com.servinglynk.hmis.warehouse.core.model.Noncashbenefits;
  import com.servinglynk.hmis.warehouse.core.model.NoncashbenefitsList;
  import com.servinglynk.hmis.warehouse.core.model.Pathstatus;
  import com.servinglynk.hmis.warehouse.core.model.Pathstatuses;
  import com.servinglynk.hmis.warehouse.core.model.Residentialmoveindate;
  import com.servinglynk.hmis.warehouse.core.model.Residentialmoveindates;
  import com.servinglynk.hmis.warehouse.core.model.Rhybcpstatus;
  import com.servinglynk.hmis.warehouse.core.model.Rhybcpstatuses;
  import com.servinglynk.hmis.warehouse.core.model.Servicefareferral;
  import com.servinglynk.hmis.warehouse.core.model.Servicefareferrals;
  import com.servinglynk.hmis.warehouse.core.model.Session;
  import com.servinglynk.hmis.warehouse.core.model.VeteranInfo;
  import com.servinglynk.hmis.warehouse.core.model.VeteranInfos;
  
  @RestController
  @RequestMapping("/clients")
  public class ClientsController extends ControllerBase {
  
  	@RequestMapping(method = RequestMethod.POST)
  	@APIMapping(value = "CLIENT_API_CREATE_CLIENT", checkSessionToken = true, checkTrustedApp = true)
  	public Client createClient(@Valid @RequestBody Client client, HttpServletRequest request) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		serviceFactory.getClientService().createClient(client, session.getAccount().getUsername());
  		Client returnClient = new Client();
  		returnClient.setClientId(client.getClientId());
  		return returnClient;
  	}
  
  	@RequestMapping(value = "/{clientid}", method = RequestMethod.PUT)
  	@APIMapping(value = "CLIENT_API_UPDATE_CLIENT", checkSessionToken = true, checkTrustedApp = true)
  	public void updateClient(@PathVariable("clientid") UUID clientId,@Valid @RequestBody Client client,
  			HttpServletRequest request) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		client.setClientId(clientId);
  		serviceFactory.getClientService().updateClient(client, session.getAccount().getUsername());
  	}
  
  	@RequestMapping(value = "/{clientid}", method = RequestMethod.DELETE)
  	@APIMapping(value = "CLIENT_API_DELETE_CLIENT", checkSessionToken = true, checkTrustedApp = true)
  	public void deleteClient(@PathVariable("clientid") UUID clientId, HttpServletRequest request,
  			HttpServletResponse response) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		serviceFactory.getClientService().deleteClient(clientId, session.getAccount().getUsername());
  		response.setStatus(HttpServletResponse.SC_NO_CONTENT);
  	}
  
  	@RequestMapping(value = "/{clientid}", method = RequestMethod.GET)
  	@APIMapping(value = "CLIENT_API_GET_CLIENT_BY_ID", checkSessionToken = true, checkTrustedApp = true)
  	public Client getClientById(@PathVariable("clientid") UUID clientId, HttpServletRequest request) throws Exception {
  		return serviceFactory.getClientService().getClientById(clientId);
  	}
  
  	@RequestMapping(method = RequestMethod.GET)
  	@APIMapping(value = "CLIENT_API_GET_ALL_CLIENTS", checkSessionToken = true, checkTrustedApp = true)
  	public Clients getAllClien(@RequestParam(value = "startIndex", required = false) Integer startIndex,
  			@RequestParam(value = "maxItems", required = false) Integer maxItems, HttpServletRequest request)
  					throws Exception {
  
  		if (startIndex == null)
  			startIndex = 0;
  		if (maxItems == null)
  			maxItems = 30;
  
  		Session session = sessionHelper.getSession(request);
           Account account = serviceFactory.getAccountService().getAccount(session.getAccount(),false);
  		return serviceFactory.getClientService().getAllClients(account.getProjectGroup().getProjectGroupCode(), startIndex,
  				maxItems);
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments", method = RequestMethod.POST)
  	@APIMapping(value = "CLIENT_API_CREATE_ENROLLMENT", checkSessionToken = true, checkTrustedApp = true)
  	public Enrollment createEnrollment(@RequestBody Enrollment enrollment, @PathVariable("clientid") UUID clientId,
  			@RequestParam(value = "updateGenericHouseHold",required = false,defaultValue = "true") Boolean updateGenericHouseHold,
  			HttpServletRequest request) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		serviceFactory.getEnrollmentService().createEnrollment(enrollment, clientId,updateGenericHouseHold,
  				session);
  		Enrollment returnEnrollment = new Enrollment();
  		returnEnrollment.setEnrollmentId(enrollment.getEnrollmentId());
  		return returnEnrollment;
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}", method = RequestMethod.PUT)
  	@APIMapping(value = "CLIENT_API_UPDATE_ENROLLMENT", checkSessionToken = true, checkTrustedApp = true)
  	public void updateEnrollment(@RequestBody Enrollment enrollment, @PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId, HttpServletRequest request) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		enrollment.setEnrollmentId(enrollmentId);
  		serviceFactory.getEnrollmentService().updateEnrollment(enrollment, clientId,
  				session.getAccount().getUsername(),session);
  	}
  
  
  	@RequestMapping(value="/{clientid}/enrollments/{enrollmentid}/calculatechronichomeless",method=RequestMethod.GET)
  	@APIMapping(value="CLIENT_API_GET_ENROLLMENT_BY_ID",checkSessionToken=true,checkTrustedApp=true)
  	public Enrollment calculateChronicHomelessness(@PathVariable("clientid") UUID clientId, @PathVariable("enrollmentid") UUID enrollmentId ,HttpServletRequest request) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		com.servinglynk.hmis.warehouse.core.model.Enrollment  enrollment = new com.servinglynk.hmis.warehouse.core.model.Enrollment();
  		enrollment.setEnrollmentId(enrollmentId);
  		return serviceFactory.getEnrollmentService().calculateChronicHomelessness(enrollment,clientId,session.getAccount().getUsername(),session);
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}", method = RequestMethod.DELETE)
  	@APIMapping(value = "CLIENT_API_DELETE_ENROLLMENT", checkSessionToken = true, checkTrustedApp = true)
  	public void deleteEnrollment(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId, HttpServletRequest request, HttpServletResponse response)
  					throws Exception {
  		Session session = sessionHelper.getSession(request);
  		serviceFactory.getEnrollmentService().deleteEnrollment(enrollmentId, clientId,
  				session.getAccount().getUsername());
  		response.setStatus(HttpServletResponse.SC_NO_CONTENT);
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}", method = RequestMethod.GET)
  	@APIMapping(value = "CLIENT_API_GET_ENROLLMENT_BY_ID", checkSessionToken = true, checkTrustedApp = true)
  	public Enrollment getClientEnrollmentById(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId, 
  			@RequestParam(value="includeChildLinks",required=false,defaultValue="false") boolean includeChildLinks,
  			HttpServletRequest request) throws Exception {
  		return serviceFactory.getEnrollmentService().getEnrollmentByClientIdAndEnrollmentId(enrollmentId, clientId,includeChildLinks);
  	}
  	
  	@RequestMapping(value="/enrollments/{enrollmentid}",method=RequestMethod.GET)
  	@APIMapping(value="GET_ENROLLMENT_BY_ID",checkSessionToken=true,checkTrustedApp=true)
  	public Enrollment getEnrollmentById(@PathVariable("enrollmentid") UUID enrollmentId ,
  			@RequestParam(value="includeChildLinks",required=false,defaultValue="false") boolean includeChildLinks,
  			HttpServletRequest request) throws Exception {
  		return serviceFactory.getEnrollmentService().getEnrollmentByEnrollmentId(enrollmentId,includeChildLinks);
  	}
  	
  	@RequestMapping(value = "/{clientid}/enrollments", method = RequestMethod.GET)
  	@APIMapping(value = "CLIENT_API_GET_ALL_CLIENT_ENROLLMENTS", checkSessionToken = true, checkTrustedApp = true)
  	public Enrollments getAllClientEnrollments(@PathVariable("clientid") UUID clientId,
  			@RequestParam(value = "startIndex", required = false) Integer startIndex,
  			@RequestParam(value = "maxItems", required = false) Integer maxItems, HttpServletRequest request)
  					throws Exception {
  		Session session = sessionHelper.getSession(request);
  		if (startIndex == null)
  			startIndex = 0;
  		if (maxItems == null)
  			maxItems = 30;
  
  		return serviceFactory.getEnrollmentService().getEnrollmentsByClientId(clientId,
  				session.getAccount().getUsername(), startIndex, maxItems);
  	}
  
  	// Veteran Info API Start
  
  	@RequestMapping(value = "/{clientid}/veteraninfos", method = RequestMethod.POST)
  	@APIMapping(value = "CLIENT_API_CREATE_VETERANINFO", checkTrustedApp = true, checkSessionToken = true)
  	public VeteranInfo createVeteranInfo(@PathVariable("clientid") UUID clientId, @RequestBody VeteranInfo veteranInfo,
  			HttpServletRequest request) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		serviceFactory.getVeteranInfoService().createVeteranInfo(veteranInfo, clientId,
  				session.getAccount().getUsername());
  		VeteranInfo returnVeteranInfo = new VeteranInfo();
  		returnVeteranInfo.setVeteranInfoId(veteranInfo.getVeteranInfoId());
  		return returnVeteranInfo;
  	}
  
  	@RequestMapping(value = "/{clientid}/veteraninfos/{veteranInfoid}", method = RequestMethod.PUT)
  	@APIMapping(value = "CLIENT_API_UPDATE_VETERANINFO", checkTrustedApp = true, checkSessionToken = true)
  	public void updateVeteranInfo(@PathVariable("clientid") UUID clientId,
  			@PathVariable("veteranInfoid") UUID veteranInfoId, @RequestBody VeteranInfo veteranInfo,
  			HttpServletRequest request) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		veteranInfo.setVeteranInfoId(veteranInfoId);
  		serviceFactory.getVeteranInfoService().updateVeteranInfo(veteranInfo, clientId,
  				session.getAccount().getUsername());
  	}
  
  	@RequestMapping(value = "/{clientid}/veteraninfos/{veteranInfoid}", method = RequestMethod.DELETE)
  	@APIMapping(value = "CLIENT_API_DELETE_VETERANINFO", checkTrustedApp = true, checkSessionToken = true)
  	public void deleteVeteranInfo(@PathVariable("clientid") UUID clientId,
  			@PathVariable("veteranInfoid") UUID veteranInfoId, HttpServletRequest request, HttpServletResponse response)
  					throws Exception {
  		serviceFactory.getClientService().getClientById(clientId);
  		Session session = sessionHelper.getSession(request);
  		serviceFactory.getVeteranInfoService().deleteVeteranInfo(veteranInfoId, session.getAccount().getUsername());
  		response.setStatus(HttpServletResponse.SC_NO_CONTENT);
  	}
  
  	@RequestMapping(value = "/{clientid}/veteraninfos/{veteranInfoid}", method = RequestMethod.GET)
  	@APIMapping(value = "CLIENT_API_GET_VETERANINFO_BY_ID", checkTrustedApp = true, checkSessionToken = true)
  	public VeteranInfo getVeteranInfoById(@PathVariable("clientid") UUID clientId,
  			@PathVariable("veteranInfoid") UUID veteranInfoId, HttpServletRequest request) throws Exception {
  		serviceFactory.getClientService().getClientById(clientId);
  		return serviceFactory.getVeteranInfoService().getVeteranInfoById(veteranInfoId);
  	}
  
  	@RequestMapping(value = "/{clientid}/veteraninfos", method = RequestMethod.GET)
  	@APIMapping(value = "CLIENT_API_GET_ALL_CLIENT_VETERANINFOS", checkTrustedApp = true, checkSessionToken = true)
  	public VeteranInfos getAllEnrollmentVeteranInfos(@PathVariable("clientid") UUID clientId,
  			@RequestParam(value = "startIndex", required = false) Integer startIndex,
  			@RequestParam(value = "maxItems", required = false) Integer maxItems, HttpServletRequest request)
  					throws Exception {
  		if (startIndex == null)
  			startIndex = 0;
  		if (maxItems == null)
  			maxItems = 30;
  		serviceFactory.getClientService().getClientById(clientId);
  		return serviceFactory.getVeteranInfoService().getAllClientVeteranInfos(clientId, startIndex, maxItems);
  
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/employments", method = RequestMethod.POST)
  	@APIMapping(value = "CLIENT_API_CREATE_EMPLOYMENT", checkTrustedApp = true, checkSessionToken = true)
  	public Employment createEmployment(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId, @RequestBody Employment employment,
  			HttpServletRequest request) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getEmploymentService().createEmployment(employment, enrollmentId,
  				session.getAccount().getUsername());
  		Employment returnemployment = new Employment();
  		returnemployment.setEmploymentId(employment.getEmploymentId());
  		return returnemployment;
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/employments/{employmentid}", method = RequestMethod.PUT)
  	@APIMapping(value = "CLIENT_API_UPDATE_EMPLOYMENT", checkTrustedApp = true, checkSessionToken = true)
  	public void updateEmployment(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId, @PathVariable("employmentid") UUID employmentId,
  			@RequestBody Employment employment, HttpServletRequest request) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		employment.setEmploymentId(employmentId);
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getEmploymentService().updateEmployment(employment, enrollmentId,
  				session.getAccount().getUsername());
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/employments/{employmentid}", method = RequestMethod.DELETE)
  	@APIMapping(value = "CLIENT_API_DELETE_EMPLOYMENT", checkTrustedApp = true, checkSessionToken = true)
  	public void deleteEmployment(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId, @PathVariable("employmentid") UUID employmentId,
  			HttpServletRequest request, HttpServletResponse response) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getEnrollmentService().getEnrollmentByClientIdAndEnrollmentId(enrollmentId, clientId,false);
  		serviceFactory.getEmploymentService().deleteEmployment(employmentId, session.getAccount().getUsername());
  		response.setStatus(HttpServletResponse.SC_NO_CONTENT);
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/employments/{employmentid}", method = RequestMethod.GET)
  	@APIMapping(value = "CLIENT_API_GET_EMPLOYMENT_BY_ID", checkTrustedApp = true, checkSessionToken = true)
  	public Employment getEmploymentById(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId, @PathVariable("employmentid") UUID employmentId,
  			HttpServletRequest request) throws Exception {
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getEnrollmentService().getEnrollmentByClientIdAndEnrollmentId(enrollmentId, clientId,false);
  		return serviceFactory.getEmploymentService().getEmploymentById(employmentId);
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/employments", method = RequestMethod.GET)
  	@APIMapping(value = "CLIENT_API_GET_ALL_ENROLLMENT_EMPLOYMENT", checkTrustedApp = true, checkSessionToken = true)
  	public Employments getAllEnrollmentEmployments(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId,
  			@RequestParam(value = "startIndex", required = false) Integer startIndex,
  			@RequestParam(value = "maxItems", required = false) Integer maxItems, HttpServletRequest request)
  					throws Exception {
  		if (startIndex == null)
  			startIndex = 0;
  		if (maxItems == null)
  			maxItems = 30;
  
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getEnrollmentService().getEnrollmentByClientIdAndEnrollmentId(enrollmentId, clientId,false);
  		return serviceFactory.getEmploymentService().getAllEnrollmentEmployments(enrollmentId, startIndex, maxItems);
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/dateofengagements", method = RequestMethod.POST)
  	@APIMapping(value = "CLIENT_API_CREATE_DATEOFENGAGEMENT", checkTrustedApp = true, checkSessionToken = true)
  	public Dateofengagement createDateofengagement(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId, @RequestBody Dateofengagement dateofengagement,
  			HttpServletRequest request) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getDateofengagementService().createDateofengagement(dateofengagement, enrollmentId,
  				session.getAccount().getUsername());
  		Dateofengagement returndateofengagement = new Dateofengagement();
  		returndateofengagement.setDateofengagementId(dateofengagement.getDateofengagementId());
  		return returndateofengagement;
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/dateofengagements/{dateofengagementid}", method = RequestMethod.PUT)
  	@APIMapping(value = "CLIENT_API_UPDATE_DATEOFENGAGEMENT", checkTrustedApp = true, checkSessionToken = true)
  	public void updateDateofengagement(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId,
  			@PathVariable("dateofengagementid") UUID dateofengagementId, @RequestBody Dateofengagement dateofengagement,
  			HttpServletRequest request) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		dateofengagement.setDateofengagementId(dateofengagementId);
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getDateofengagementService().updateDateofengagement(dateofengagement, enrollmentId,
  				session.getAccount().getUsername());
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/dateofengagements/{dateofengagementid}", method = RequestMethod.DELETE)
  	@APIMapping(value = "CLIENT_API_DELETE_DATEOFENGAGEMENT", checkTrustedApp = true, checkSessionToken = true)
  	public void deleteDateofengagement(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId,
  			@PathVariable("dateofengagementid") UUID dateofengagementId, HttpServletRequest request,
  			HttpServletResponse response) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getEnrollmentService().getEnrollmentByClientIdAndEnrollmentId(enrollmentId, clientId,false);
  		serviceFactory.getDateofengagementService().deleteDateofengagement(dateofengagementId,
  				session.getAccount().getUsername());
  		response.setStatus(HttpServletResponse.SC_NO_CONTENT);
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/dateofengagements/{dateofengagementid}", method = RequestMethod.GET)
  	@APIMapping(value = "CLIENT_API_GET_DATEOFENGAGEMENT_BY_ID", checkTrustedApp = true, checkSessionToken = true)
  	public Dateofengagement getDateofengagementById(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId,
  			@PathVariable("dateofengagementid") UUID dateofengagementId, HttpServletRequest request) throws Exception {
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getEnrollmentService().getEnrollmentByClientIdAndEnrollmentId(enrollmentId, clientId,false);
  		return serviceFactory.getDateofengagementService().getDateofengagementById(dateofengagementId);
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/dateofengagements", method = RequestMethod.GET)
  	@APIMapping(value = "CLIENT_API_GET_ALL_ENROLLMENT_DATEOFENGAGEMENT", checkTrustedApp = true, checkSessionToken = true)
  	public Dateofengagements getAllEnrollmentDateofengagements(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId,
  			@RequestParam(value = "startIndex", required = false) Integer startIndex,
  			@RequestParam(value = "maxItems", required = false) Integer maxItems, HttpServletRequest request)
  					throws Exception {
  		if (startIndex == null)
  			startIndex = 0;
  		if (maxItems == null)
  			maxItems = 30;
  
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getEnrollmentService().getEnrollmentByClientIdAndEnrollmentId(enrollmentId, clientId,false);
  		return serviceFactory.getDateofengagementService().getAllEnrollmentDateofengagements(enrollmentId, startIndex,
  				maxItems);
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/disabilities", method = RequestMethod.POST)
  	@APIMapping(value = "CLIENT_API_CREATE_DISABILITIES", checkTrustedApp = true, checkSessionToken = true)
  	public Disabilities createDisabilities(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId, @RequestBody Disabilities disabilities,
  			HttpServletRequest request) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getDisabilitiesService().createDisabilities(disabilities, enrollmentId,
  				session.getAccount().getUsername());
  		Disabilities returndisabilities = new Disabilities();
  		returndisabilities.setDisabilitiesId(disabilities.getDisabilitiesId());
  		return returndisabilities;
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/disabilities/{disabilitiesid}", method = RequestMethod.PUT)
  	@APIMapping(value = "CLIENT_API_UPDATE_DISABILITIES", checkTrustedApp = true, checkSessionToken = true)
  	public void updateDisabilities(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId, @PathVariable("disabilitiesid") UUID disabilitiesId,
  			@RequestBody Disabilities disabilities, HttpServletRequest request) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		disabilities.setDisabilitiesId(disabilitiesId);
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getDisabilitiesService().updateDisabilities(disabilities, enrollmentId,
  				session.getAccount().getUsername());
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/disabilities/{disabilitiesid}", method = RequestMethod.DELETE)
  	@APIMapping(value = "CLIENT_API_DELETE_DISABILITIES", checkTrustedApp = true, checkSessionToken = true)
  	public void deleteDisabilities(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId, @PathVariable("disabilitiesid") UUID disabilitiesId,
  			HttpServletRequest request, HttpServletResponse response) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getEnrollmentService().getEnrollmentByClientIdAndEnrollmentId(enrollmentId, clientId,false);
  		serviceFactory.getDisabilitiesService().deleteDisabilities(disabilitiesId, session.getAccount().getUsername());
  		response.setStatus(HttpServletResponse.SC_NO_CONTENT);
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/disabilities/{disabilitiesid}", method = RequestMethod.GET)
  	@APIMapping(value = "CLIENT_API_GET_DISABILITIES_BY_ID", checkTrustedApp = true, checkSessionToken = true)
  	public Disabilities getDisabilitiesById(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId, @PathVariable("disabilitiesid") UUID disabilitiesId,
  			HttpServletRequest request) throws Exception {
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getEnrollmentService().getEnrollmentByClientIdAndEnrollmentId(enrollmentId, clientId,false);
  		return serviceFactory.getDisabilitiesService().getDisabilitiesById(disabilitiesId);
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/disabilities", method = RequestMethod.GET)
  	@APIMapping(value = "CLIENT_API_GET_ALL_ENROLLMENT_DISABILITIES", checkTrustedApp = true, checkSessionToken = true)
  	public DisabilitiesList getAllEnrollmentDisabilitiess(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId,
  			@RequestParam(value = "startIndex", required = false) Integer startIndex,
  			@RequestParam(value = "maxItems", required = false) Integer maxItems, HttpServletRequest request)
  					throws Exception {
  		if (startIndex == null)
  			startIndex = 0;
  		if (maxItems == null)
  			maxItems = 30;
  
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getEnrollmentService().getEnrollmentByClientIdAndEnrollmentId(enrollmentId, clientId,false);
  		return serviceFactory.getDisabilitiesService().getAllEnrollmentDisabilitiess(enrollmentId, startIndex,
  				maxItems);
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/domesticviolences", method = RequestMethod.POST)
  	@APIMapping(value = "CLIENT_API_CREATE_DOMESTICVIOLENCE", checkTrustedApp = true, checkSessionToken = true)
  	public Domesticviolence createDomesticviolence(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId, @RequestBody Domesticviolence domesticviolence,
  			HttpServletRequest request) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getDomesticviolenceService().createDomesticviolence(domesticviolence, enrollmentId,
  				session.getAccount().getUsername());
  		Domesticviolence returndomesticviolence = new Domesticviolence();
  		returndomesticviolence.setDomesticviolenceId(domesticviolence.getDomesticviolenceId());
  		return returndomesticviolence;
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/domesticviolences/{domesticviolenceid}", method = RequestMethod.PUT)
  	@APIMapping(value = "CLIENT_API_UPDATE_DOMESTICVIOLENCE", checkTrustedApp = true, checkSessionToken = true)
  	public void updateDomesticviolence(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId,
  			@PathVariable("domesticviolenceid") UUID domesticviolenceId, @RequestBody Domesticviolence domesticviolence,
  			HttpServletRequest request) throws Exception {
  		Session session = sessionHelper.getSession(request);
  		domesticviolence.setDomesticviolenceId(domesticviolenceId);
  		serviceFactory.getClientService().getClientById(clientId);
  		serviceFactory.getDomesticviolenceService().updateDomesticviolence(domesticviolence, enrollmentId,
  				session.getAccount().getUsername());
  	}
  
  	@RequestMapping(value = "/{clientid}/enrollments/{enrollmentid}/domesticviolences/{domesticviolenceid}", method = RequestMethod.DELETE)
  	@APIMapping(value = "CLIENT_API_DELETE_DOMESTICVIOLENCE", checkTrustedApp = true, checkSessionToken = true)
  	public void deleteDomesticviolence(@PathVariable("clientid") UUID clientId,
  			@PathVariable("enrollmentid") UUID enrollmentId,
  			@PathVariable("domesticviolenceid") UUID domesticviolenceId, HttpServletRequest request,
  			HttpServletResponse response) throws Exception {
  