Search in sources :

Example 6 with RFA1aForm

use of gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aForm 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)

Example 7 with RFA1aForm

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

the class RFA1aFormsDao method findAll.

/**
 * Find all RFA1a forms.
 *
 * @param maxResults  expected maximum results
 * @return List of RFA1aForm
 */
public List<RFA1aForm> findAll(int maxResults) {
    Session session = this.getSessionFactory().getCurrentSession();
    Query<RFA1aForm> query = session.createNamedQuery(RFA1aForm.NAMED_QUERY_FIND_ALL, RFA1aForm.class);
    query.setMaxResults(maxResults);
    ImmutableList.Builder<RFA1aForm> entities = new ImmutableList.Builder<>();
    entities.addAll(query.list());
    return entities.build();
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) RFA1aForm(gov.ca.cwds.cals.persistence.model.calsns.rfa.RFA1aForm) Session(org.hibernate.Session)

Example 8 with RFA1aForm

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

the class ApplicantNamesDuplicationConstraintPostConfiguration 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)

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