Search in sources :

Example 1 with FormSelectionMaintenanceInDto

use of org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceInDto in project jaffa-framework by jaffa-projects.

the class FormSelectionMaintenanceComponent method doInquiry.

// .//GEN-END:value6_1_be
// .//GEN-BEGIN:_doInquiry_1_be
/**
 * This performs the actual query to obtain the FinderOutDto.
 * @throws ApplicationExceptions This will be thrown in case any invalid data has been set.
 * @throws FrameworkException Indicates some system error.
 * @return the FinderOutDto object.
 */
protected FinderOutDto doInquiry() throws ApplicationExceptions, FrameworkException {
    ApplicationExceptions appExps = null;
    FormSelectionMaintenanceInDto inputDto = new FormSelectionMaintenanceInDto();
    /**
     *  Check that a proper form Event was found.
     *  Give a message that no events are defined for the form preview link.
     *  Conditions are:
     *  getEvent().startsWith("???") indicates the event label was not found.
     *  getEvent().equals("") indicates the event label was found but no event was defined.
     */
    if (getAutoDisplayAll()) {
        if (getEvent() == null || getEvent().startsWith("???") || getEvent().equals("")) {
            throw new ApplicationExceptions(new FormSelectionException(FormSelectionException.FORM_PREVIEW_EVENT_NOT_DEFINED) {
            });
        }
    }
    // Check for Mandatory fields (Event & Key1/Voucher are mandatory)
    if (getEvent() == null) {
        if (appExps == null) {
            appExps = new ApplicationExceptions();
        }
        appExps.add(new MandatoryFieldException("[label.Jaffa.Printing.FormSelection.Event]"));
    }
    if (getKey1() == null) {
        if (appExps == null) {
            appExps = new ApplicationExceptions();
        }
        appExps.add(new MandatoryFieldException("[label.Jaffa.Printing.FormSelection.Key1]"));
    }
    if (appExps != null && appExps.size() > 0) {
        throw appExps;
    }
    inputDto.setDefaultPrinters(getDefaultPrinters());
    // .//GEN-LAST:_doInquiry_1
    // .//GEN-BEGIN:_doInquiry_2_be
    inputDto.setMaxRecords(getMaxRecords());
    if (getEvent() != null || CriteriaField.RELATIONAL_IS_NULL.equals(getEventDd()) || CriteriaField.RELATIONAL_IS_NOT_NULL.equals(getEventDd())) {
        inputDto.setEvent(StringCriteriaField.getStringCriteriaField(getEventDd(), getEvent(), null));
    }
    if (getKey1() != null || CriteriaField.RELATIONAL_IS_NULL.equals(getKey1Dd()) || CriteriaField.RELATIONAL_IS_NOT_NULL.equals(getKey1Dd())) {
        inputDto.setKey1(StringCriteriaField.getStringCriteriaField(getKey1Dd(), getKey1(), null));
    }
    if (getKey2() != null || CriteriaField.RELATIONAL_IS_NULL.equals(getKey2Dd()) || CriteriaField.RELATIONAL_IS_NOT_NULL.equals(getKey2Dd())) {
        inputDto.setKey2(StringCriteriaField.getStringCriteriaField(getKey2Dd(), getKey2(), null));
    }
    if (getKey3() != null || CriteriaField.RELATIONAL_IS_NULL.equals(getKey3Dd()) || CriteriaField.RELATIONAL_IS_NOT_NULL.equals(getKey3Dd())) {
        inputDto.setKey3(StringCriteriaField.getStringCriteriaField(getKey3Dd(), getKey3(), null));
    }
    if (getKey4() != null || CriteriaField.RELATIONAL_IS_NULL.equals(getKey4Dd()) || CriteriaField.RELATIONAL_IS_NOT_NULL.equals(getKey4Dd())) {
        inputDto.setKey4(StringCriteriaField.getStringCriteriaField(getKey4Dd(), getKey4(), null));
    }
    if (getKey5() != null || CriteriaField.RELATIONAL_IS_NULL.equals(getKey5Dd()) || CriteriaField.RELATIONAL_IS_NOT_NULL.equals(getKey5Dd())) {
        inputDto.setKey5(StringCriteriaField.getStringCriteriaField(getKey5Dd(), getKey5(), null));
    }
    if (getKey6() != null || CriteriaField.RELATIONAL_IS_NULL.equals(getKey6Dd()) || CriteriaField.RELATIONAL_IS_NOT_NULL.equals(getKey6Dd())) {
        inputDto.setKey6(StringCriteriaField.getStringCriteriaField(getKey6Dd(), getKey6(), null));
    }
    if (getValue1() != null || CriteriaField.RELATIONAL_IS_NULL.equals(getValue1Dd()) || CriteriaField.RELATIONAL_IS_NOT_NULL.equals(getValue1Dd())) {
        inputDto.setValue1(StringCriteriaField.getStringCriteriaField(getValue1Dd(), getValue1(), null));
    }
    if (getValue2() != null || CriteriaField.RELATIONAL_IS_NULL.equals(getValue2Dd()) || CriteriaField.RELATIONAL_IS_NOT_NULL.equals(getValue2Dd())) {
        inputDto.setValue2(StringCriteriaField.getStringCriteriaField(getValue2Dd(), getValue2(), null));
    }
    if (getValue3() != null || CriteriaField.RELATIONAL_IS_NULL.equals(getValue3Dd()) || CriteriaField.RELATIONAL_IS_NOT_NULL.equals(getValue3Dd())) {
        inputDto.setValue3(StringCriteriaField.getStringCriteriaField(getValue3Dd(), getValue3(), null));
    }
    if (getValue4() != null || CriteriaField.RELATIONAL_IS_NULL.equals(getValue4Dd()) || CriteriaField.RELATIONAL_IS_NOT_NULL.equals(getValue4Dd())) {
        inputDto.setValue4(StringCriteriaField.getStringCriteriaField(getValue4Dd(), getValue4(), null));
    }
    if (getValue5() != null || CriteriaField.RELATIONAL_IS_NULL.equals(getValue5Dd()) || CriteriaField.RELATIONAL_IS_NOT_NULL.equals(getValue5Dd())) {
        inputDto.setValue5(StringCriteriaField.getStringCriteriaField(getValue5Dd(), getValue5(), null));
    }
    if (getValue6() != null || CriteriaField.RELATIONAL_IS_NULL.equals(getValue6Dd()) || CriteriaField.RELATIONAL_IS_NOT_NULL.equals(getValue6Dd())) {
        inputDto.setValue6(StringCriteriaField.getStringCriteriaField(getValue6Dd(), getValue6(), null));
    }
    // throw ApplicationExceptions, if any parsing errors occured
    if (appExps != null && appExps.size() > 0) {
        throw appExps;
    }
    inputDto.setHeaderDto(getHeaderDto());
    addSortCriteria(inputDto);
    // perform the inquiry
    if (m_tx == null) {
        m_tx = (IFormSelectionMaintenance) Factory.createObject(IFormSelectionMaintenance.class);
    }
    FinderOutDto finderOutDto = m_tx.find(inputDto);
    // .//GEN-END:_doInquiry_2_be
    // Add custom code after the Transaction//GEN-FIRST:_doInquiry_2
    finderOutDto = m_tx.findOutDto(inputDto);
    // .//GEN-BEGIN:_doInquiry_3_be
    return finderOutDto;
}
Also used : FormSelectionException(org.jaffa.modules.printing.components.formselectionmaintenance.FormSelectionException) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) MandatoryFieldException(org.jaffa.datatypes.exceptions.MandatoryFieldException) FormSelectionMaintenanceInDto(org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceInDto)

Example 2 with FormSelectionMaintenanceInDto

use of org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceInDto in project jaffa-framework by jaffa-projects.

the class FormSelectionMaintenanceComponent method doInquiry2.

/**
 * This performs the query to obtain the FinderOutDto.
 * @throws ApplicationExceptions This will be thrown in case any invalid data has been set.
 * @throws FrameworkException Indicates some system error.
 * @return the FinderOutDto object.
 */
private FinderOutDto doInquiry2() throws ApplicationExceptions, FrameworkException {
    FormSelectionMaintenanceInDto inputDto = new FormSelectionMaintenanceInDto();
    inputDto.setDefaultPrinters(getDefaultPrinters());
    inputDto.setMaxRecords(getMaxRecords());
    if (getEvent() != null) {
        inputDto.setEvent(StringCriteriaField.getStringCriteriaField(getEventDd(), getEvent(), null));
    }
    if (getKey1() != null) {
        inputDto.setKey1(StringCriteriaField.getStringCriteriaField(getKey1Dd(), getKey1(), null));
    }
    if (getKey2() != null) {
        inputDto.setKey2(StringCriteriaField.getStringCriteriaField(getKey2Dd(), getKey2(), null));
    }
    if (getKey3() != null) {
        inputDto.setKey3(StringCriteriaField.getStringCriteriaField(getKey3Dd(), getKey3(), null));
    }
    if (getKey4() != null) {
        inputDto.setKey4(StringCriteriaField.getStringCriteriaField(getKey4Dd(), getKey4(), null));
    }
    if (getKey5() != null) {
        inputDto.setKey5(StringCriteriaField.getStringCriteriaField(getKey5Dd(), getKey5(), null));
    }
    if (getKey6() != null) {
        inputDto.setKey6(StringCriteriaField.getStringCriteriaField(getKey6Dd(), getKey6(), null));
    }
    if (getValue1() != null) {
        inputDto.setValue1(StringCriteriaField.getStringCriteriaField(getValue1Dd(), getValue1(), null));
    }
    if (getValue2() != null) {
        inputDto.setValue2(StringCriteriaField.getStringCriteriaField(getValue2Dd(), getValue2(), null));
    }
    if (getValue3() != null) {
        inputDto.setValue3(StringCriteriaField.getStringCriteriaField(getValue3Dd(), getValue3(), null));
    }
    if (getValue4() != null) {
        inputDto.setValue4(StringCriteriaField.getStringCriteriaField(getValue4Dd(), getValue4(), null));
    }
    if (getValue5() != null) {
        inputDto.setValue5(StringCriteriaField.getStringCriteriaField(getValue5Dd(), getValue5(), null));
    }
    if (getValue6() != null) {
        inputDto.setValue6(StringCriteriaField.getStringCriteriaField(getValue6Dd(), getValue6(), null));
    }
    if (m_tx == null) {
        m_tx = (IFormSelectionMaintenance) Factory.createObject(IFormSelectionMaintenance.class);
    }
    FinderOutDto finderOutDto = m_tx.findOutDto(inputDto);
    return finderOutDto;
}
Also used : FormSelectionMaintenanceInDto(org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceInDto)

Aggregations

FormSelectionMaintenanceInDto (org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceInDto)2 MandatoryFieldException (org.jaffa.datatypes.exceptions.MandatoryFieldException)1 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)1 FormSelectionException (org.jaffa.modules.printing.components.formselectionmaintenance.FormSelectionException)1