Search in sources :

Example 1 with RFA1aForm

use of gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aForm in project cals-api by ca-cwds.

the class AbstractRFAInternalEntityService method update.

@Override
public T update(Long applicationId, T request) {
    RFA1aForm form = applicationDao.find(applicationId);
    if (form == null) {
        throw new ExpectedException(Constants.ExpectedExceptionMessages.RFA_1A_APPLICATION_NOT_FOUND_BY_ID, NOT_FOUND);
    }
    form.setUpdateDateTime(LocalDateTime.now());
    form.setUpdateUserId(PrincipalUtils.getStaffPersonId());
    configuration.putEntityToTheForm(form, request);
    RFA1aForm updatedForm = applicationDao.update(form);
    return configuration.getEntityFromTheForm(updatedForm);
}
Also used : RFA1aForm(gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aForm) ExpectedException(gov.ca.cwds.rest.exception.ExpectedException)

Example 2 with RFA1aForm

use of gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aForm in project cals-api by ca-cwds.

the class RFA1aFormService method updateFormAfterPlacementHomeCreation.

private void updateFormAfterPlacementHomeCreation(Long formId, String placementHomeId, RFAApplicationStatus newStatus) {
    RFA1aForm form = xaRfa1AFormsDao.find(formId);
    form.setStatus(newStatus);
    form.setPlacementHomeId(placementHomeId);
    xaRfa1AFormsDao.update(fillFormUpdateAttributes(form));
}
Also used : RFA1aForm(gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aForm)

Example 3 with RFA1aForm

use of gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aForm in project cals-api by ca-cwds.

the class RFA1aFormService method find.

@UnitOfWork(CALSNS)
@Override
public RFA1aFormDTO find(RFA1aFormsParameterObject parameterObject) {
    RFA1aForm form = rfa1AFormsDao.find(parameterObject.getFormId());
    RFA1aFormDTO formDTO;
    if (parameterObject.isExpanded()) {
        formDTO = rfa1aFomMapper.toExpandedRFA1aFormDTO(form);
    } else {
        formDTO = rfa1aFomMapper.toRFA1aFormDTO(form);
    }
    return formDTO;
}
Also used : RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) RFA1aForm(gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aForm) UnitOfWork(io.dropwizard.hibernate.UnitOfWork)

Example 4 with RFA1aForm

use of gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aForm in project cals-api by ca-cwds.

the class ApplicantNamesDuplicationConstraintPutConfiguration method getValidatedFact.

@Override
public RFA1aForm getValidatedFact(Object[] input) {
    BusinessValidationParameterObject<ApplicantDTO> parameterObject = getBusinessValidationParameterObject(input);
    RFA1aForm form = getFormDao().find(parameterObject.getFormId());
    return buildModifiedForm(form, parameterObject.getEntityDTO());
}
Also used : RFA1aForm(gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aForm) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO)

Example 5 with RFA1aForm

use of gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aForm in project cals-api by ca-cwds.

the class RFA1aApplicantService method create.

@Override
public ApplicantDTO create(RFAExternalEntityUpdateParameterObject<ApplicantDTO> request) {
    ApplicantDTO applicant = super.create(request);
    RFA1aForm form = formsDao.find(request.getFormId());
    if (form.getStatus() != RFAApplicationStatus.IN_PROGRESS) {
        form.setStatus(RFAApplicationStatus.IN_PROGRESS);
    }
    return applicant;
}
Also used : RFA1aForm(gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aForm) ApplicantDTO(gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO)

Aggregations

RFA1aForm (gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aForm)8 ApplicantDTO (gov.ca.cwds.cals.service.dto.rfa.ApplicantDTO)3 UnitOfWork (io.dropwizard.hibernate.UnitOfWork)2 ImmutableList (com.google.common.collect.ImmutableList)1 RFA1aFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO)1 ExpectedException (gov.ca.cwds.rest.exception.ExpectedException)1 LocalDateTime (java.time.LocalDateTime)1 Session (org.hibernate.Session)1