Search in sources :

Example 6 with UnitOfWork

use of io.dropwizard.hibernate.UnitOfWork in project cals-api by ca-cwds.

the class LisFacilityService method findLisFacilityByLicenseNumber.

@UnitOfWork(LIS)
LisFacFile findLisFacilityByLicenseNumber(FacilityParameterObject parameterObject) {
    LisFacFile lisFacFile = lisFacFileLisDao.find(Integer.valueOf(parameterObject.getFacilityId()));
    if (lisFacFile == null) {
        return null;
    }
    Integer countyCode = lisFacFile.getCountyCode();
    if (countyCode != null) {
        LisTableFile county = lisTableFileDao.findCounty(countyCode);
        lisFacFile.setCounty(county);
    }
    Integer facilityStatusCode = lisFacFile.getFacilityStatusCode();
    if (facilityStatusCode != null) {
        LisTableFile facilityStatus = lisTableFileDao.findFacilityStatus(facilityStatusCode);
        lisFacFile.setFacilityStatus(facilityStatus);
    }
    Integer facilityTypeCode = lisFacFile.getFacilityTypeCode();
    if (facilityTypeCode != null) {
        LisTableFile facilityType = lisTableFileDao.findFacilityType(facilityTypeCode);
        lisFacFile.setFacilityType(facilityType);
    }
    return lisFacFile;
}
Also used : LisTableFile(gov.ca.cwds.cals.persistence.model.lisfas.LisTableFile) LisFacFile(gov.ca.cwds.cals.persistence.model.lisfas.LisFacFile) UnitOfWork(io.dropwizard.hibernate.UnitOfWork)

Example 7 with UnitOfWork

use of io.dropwizard.hibernate.UnitOfWork in project cals-api by ca-cwds.

the class RFA1aFormService method create.

@UnitOfWork(CALSNS)
@Override
public RFA1aFormDTO create(RFA1aFormDTO formDTO) {
    RFA1aForm form = new RFA1aForm();
    rfa1aFomMapper.toRFA1aForm(form, formDTO);
    String staffPersonId = PrincipalUtils.getStaffPersonId();
    LocalDateTime now = LocalDateTime.now();
    form.setCreateDateTime(now);
    form.setCreateUserId(staffPersonId);
    form.setUpdateDateTime(now);
    form.setUpdateUserId(staffPersonId);
    form.setStatus(RFAApplicationStatus.DRAFT);
    form = rfa1AFormsDao.create(form);
    return rfa1aFomMapper.toRFA1aFormDTO(form);
}
Also used : LocalDateTime(java.time.LocalDateTime) RFA1aForm(gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aForm) UnitOfWork(io.dropwizard.hibernate.UnitOfWork)

Aggregations

UnitOfWork (io.dropwizard.hibernate.UnitOfWork)7 RFA1aForm (gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aForm)2 LisTableFile (gov.ca.cwds.cals.persistence.model.lisfas.LisTableFile)2 PostedAllegation (gov.ca.cwds.rest.api.domain.cms.PostedAllegation)2 LisFacFile (gov.ca.cwds.cals.persistence.model.lisfas.LisFacFile)1 RFA1aFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO)1 ApiException (gov.ca.cwds.rest.api.ApiException)1 Allegation (gov.ca.cwds.rest.api.domain.Allegation)1 CrossReport (gov.ca.cwds.rest.api.domain.CrossReport)1 Participant (gov.ca.cwds.rest.api.domain.Participant)1 Person (gov.ca.cwds.rest.api.domain.Person)1 PostedPerson (gov.ca.cwds.rest.api.domain.PostedPerson)1 PostedScreeningToReferral (gov.ca.cwds.rest.api.domain.PostedScreeningToReferral)1 ScreeningToReferral (gov.ca.cwds.rest.api.domain.ScreeningToReferral)1 Allegation (gov.ca.cwds.rest.api.domain.cms.Allegation)1 Client (gov.ca.cwds.rest.api.domain.cms.Client)1 ClientUc (gov.ca.cwds.rest.api.domain.cms.ClientUc)1 CmsReferral (gov.ca.cwds.rest.api.domain.cms.CmsReferral)1 CrossReport (gov.ca.cwds.rest.api.domain.cms.CrossReport)1 PostedClient (gov.ca.cwds.rest.api.domain.cms.PostedClient)1