Search in sources :

Example 16 with ApplicationExceptions

use of org.jaffa.exceptions.ApplicationExceptions in project jaffa-framework by jaffa-projects.

the class FormTemplateFinderAction method do_CreateFromResults_Clicked.

// .//GEN-END:_do_CreateFromCriteria_Clicked_4_be
// .//GEN-BEGIN:_do_CreateFromResults_Clicked_1_be
/**
 * Invokes the createFromResults() method on the component.
 * @return The FormKey for the Create screen.
 */
public FormKey do_CreateFromResults_Clicked() {
    FormKey fk = null;
    // .//GEN-END:_do_CreateFromResults_Clicked_1_be
    // Add custom code before processing the action //GEN-FIRST:_do_CreateFromResults_Clicked_1
    // .//GEN-LAST:_do_CreateFromResults_Clicked_1
    // .//GEN-BEGIN:_do_CreateFromResults_Clicked_2_be
    FormTemplateFinderForm myForm = (FormTemplateFinderForm) form;
    FormTemplateFinderComponent myComp = (FormTemplateFinderComponent) myForm.getComponent();
    try {
        // .//GEN-END:_do_CreateFromResults_Clicked_2_be
        // Add custom code before invoking the component //GEN-FIRST:_do_CreateFromResults_Clicked_2
        // .//GEN-LAST:_do_CreateFromResults_Clicked_2
        // .//GEN-BEGIN:_do_CreateFromResults_Clicked_3_be
        fk = myComp.createFromResults();
    } catch (ApplicationExceptions e) {
        if (log.isDebugEnabled())
            log.debug("Create Failed");
        myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
    } catch (FrameworkException e) {
        log.error(null, e);
        myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
    }
    // Direct User back to current form
    if (fk == null)
        fk = myComp.getResultsFormKey();
    return fk;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FrameworkException(org.jaffa.exceptions.FrameworkException) FormKey(org.jaffa.presentation.portlet.FormKey)

Example 17 with ApplicationExceptions

use of org.jaffa.exceptions.ApplicationExceptions in project jaffa-framework by jaffa-projects.

the class FormTemplateFinderAction method do_Rows_Delete_Clicked.

// .//GEN-END:_do_Rows_Update_Clicked_4_be
// .//GEN-BEGIN:_do_Rows_Delete_Clicked_1_be
/**
 * Invokes the deleteObject() method on the component.
 * @param rowNum The selected row on the Results screen.
 * @return The FormKey for the Delete screen.
 */
public FormKey do_Rows_Delete_Clicked(String rowNum) {
    FormKey fk = null;
    // .//GEN-END:_do_Rows_Delete_Clicked_1_be
    // Add custom code before processing the action //GEN-FIRST:_do_Rows_Delete_Clicked_1
    // .//GEN-LAST:_do_Rows_Delete_Clicked_1
    // .//GEN-BEGIN:_do_Rows_Delete_Clicked_2_be
    FormTemplateFinderForm myForm = (FormTemplateFinderForm) form;
    FormTemplateFinderComponent myComp = (FormTemplateFinderComponent) myForm.getComponent();
    try {
        // This will stop double submits
        performTokenValidation(request);
        GridModel model = (GridModel) myForm.getRowsWM();
        GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
        if (selectedRow != null) {
            // .//GEN-END:_do_Rows_Delete_Clicked_2_be
            // Add custom code before invoking the component //GEN-FIRST:_do_Rows_Delete_Clicked_2
            // .//GEN-LAST:_do_Rows_Delete_Clicked_2
            // .//GEN-BEGIN:_do_Rows_Delete_Clicked_3_be
            fk = myComp.deleteObject((java.lang.Long) selectedRow.get("formId"));
        }
    } catch (ApplicationExceptions e) {
        if (log.isDebugEnabled())
            log.debug("Delete Failed");
        myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
    } catch (FrameworkException e) {
        log.error(null, e);
        myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
    }
    // Direct User back to current form
    if (fk == null)
        fk = myComp.getResultsFormKey();
    return fk;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FrameworkException(org.jaffa.exceptions.FrameworkException) GridModel(org.jaffa.presentation.portlet.widgets.model.GridModel) FormKey(org.jaffa.presentation.portlet.FormKey) GridModelRow(org.jaffa.presentation.portlet.widgets.model.GridModelRow)

Example 18 with ApplicationExceptions

use of org.jaffa.exceptions.ApplicationExceptions in project jaffa-framework by jaffa-projects.

the class FormTemplateFinderAction method do_Rows_View_Clicked.

// .//GEN-END:_do_CreateFromResults_Clicked_4_be
// .//GEN-BEGIN:_do_Rows_View_Clicked_1_be
/**
 * Invokes the viewObject() method on the component.
 * @param rowNum The selected row on the Results screen.
 * @return The FormKey for the View screen.
 */
public FormKey do_Rows_View_Clicked(String rowNum) {
    FormKey fk = null;
    // .//GEN-END:_do_Rows_View_Clicked_1_be
    // Add custom code before processing the action //GEN-FIRST:_do_Rows_View_Clicked_1
    // .//GEN-LAST:_do_Rows_View_Clicked_1
    // .//GEN-BEGIN:_do_Rows_View_Clicked_2_be
    FormTemplateFinderForm myForm = (FormTemplateFinderForm) form;
    FormTemplateFinderComponent myComp = (FormTemplateFinderComponent) myForm.getComponent();
    GridModel model = (GridModel) myForm.getRowsWM();
    GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
    if (selectedRow != null) {
        try {
            // .//GEN-END:_do_Rows_View_Clicked_2_be
            // Add custom code before invoking the component //GEN-FIRST:_do_Rows_View_Clicked_2
            // .//GEN-LAST:_do_Rows_View_Clicked_2
            // .//GEN-BEGIN:_do_Rows_View_Clicked_3_be
            fk = myComp.viewObject((java.lang.Long) selectedRow.get("formId"));
        } catch (ApplicationExceptions e) {
            if (log.isDebugEnabled())
                log.debug("Viewer Failed");
            myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
        } catch (FrameworkException e) {
            log.error(null, e);
            myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
        }
    }
    // .//GEN-END:_do_Rows_View_Clicked_3_be
    // Add custom code after returning from the component //GEN-FIRST:_do_Rows_View_Clicked_3
    // .//GEN-LAST:_do_Rows_View_Clicked_3
    // .//GEN-BEGIN:_do_Rows_View_Clicked_4_be
    // The Viewer will be rendered in a new window
    // We don't want to see the existing HistoryNav in that window
    // Hence, initialize the HistoryNav
    HistoryNav.initializeHistoryNav(request);
    // Direct User back to current form
    if (fk == null)
        fk = myComp.getResultsFormKey();
    return fk;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FrameworkException(org.jaffa.exceptions.FrameworkException) GridModel(org.jaffa.presentation.portlet.widgets.model.GridModel) FormKey(org.jaffa.presentation.portlet.FormKey) GridModelRow(org.jaffa.presentation.portlet.widgets.model.GridModelRow)

Example 19 with ApplicationExceptions

use of org.jaffa.exceptions.ApplicationExceptions in project jaffa-framework by jaffa-projects.

the class FormTemplateFinderComponent method doInquiry.

// .//GEN-END:layoutData_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;
    FormTemplateFinderInDto inputDto = new FormTemplateFinderInDto();
    // .//GEN-END:_doInquiry_1_be
    // Add custom code before processing the method //GEN-FIRST:_doInquiry_1
    // .//GEN-LAST:_doInquiry_1
    // .//GEN-BEGIN:_doInquiry_2_be
    inputDto.setMaxRecords(getMaxRecords());
    try {
        if (getFormId() != null || CriteriaField.RELATIONAL_IS_NULL.equals(getFormIdDd()) || CriteriaField.RELATIONAL_IS_NOT_NULL.equals(getFormIdDd()))
            inputDto.setFormId(IntegerCriteriaField.getIntegerCriteriaField(getFormIdDd(), getFormId(), (IntegerFieldMetaData) FormTemplateMeta.META_FORM_ID));
    } catch (ValidationException e) {
        if (appExps == null)
            appExps = new ApplicationExceptions();
        appExps.add(e);
    }
    if (getTemplateData() != null || CriteriaField.RELATIONAL_IS_NULL.equals(getTemplateDataDd()) || CriteriaField.RELATIONAL_IS_NOT_NULL.equals(getTemplateDataDd()))
        inputDto.setTemplateData(RawCriteriaField.getRawCriteriaField(getTemplateDataDd(), getTemplateData(), null));
    if (getLayoutData() != null || CriteriaField.RELATIONAL_IS_NULL.equals(getLayoutDataDd()) || CriteriaField.RELATIONAL_IS_NOT_NULL.equals(getLayoutDataDd()))
        inputDto.setLayoutData(RawCriteriaField.getRawCriteriaField(getLayoutDataDd(), getLayoutData(), 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 = (IFormTemplateFinder) Factory.createObject(IFormTemplateFinder.class);
    FinderOutDto finderOutDto = m_tx.find(inputDto);
    // .//GEN-BEGIN:_doInquiry_3_be
    return finderOutDto;
}
Also used : FormTemplateFinderInDto(org.jaffa.modules.printing.components.formtemplatefinder.dto.FormTemplateFinderInDto) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FormTemplateFinderOutDto(org.jaffa.modules.printing.components.formtemplatefinder.dto.FormTemplateFinderOutDto) IFormTemplateFinder(org.jaffa.modules.printing.components.formtemplatefinder.IFormTemplateFinder)

Example 20 with ApplicationExceptions

use of org.jaffa.exceptions.ApplicationExceptions in project jaffa-framework by jaffa-projects.

the class FormTemplateFinderComponent method initializeCriteriaScreen.

// .//GEN-END:_addListeners_1_be
// .//GEN-BEGIN:_initializeCriteriaScreen_1_be
/**
 * This will retrieve the set of codes for dropdowns, if any are required
 * @throws ApplicationExceptions This will be thrown in case any invalid data has been set.
 * @throws FrameworkException Indicates some system error.
 */
protected void initializeCriteriaScreen() throws ApplicationExceptions, FrameworkException {
    ApplicationExceptions appExps = null;
    CodeHelperInDto input = null;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions)

Aggregations

ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)575 FrameworkException (org.jaffa.exceptions.FrameworkException)307 FormKey (org.jaffa.presentation.portlet.FormKey)205 ApplicationException (org.jaffa.exceptions.ApplicationException)116 GridModel (org.jaffa.presentation.portlet.widgets.model.GridModel)104 GridModelRow (org.jaffa.presentation.portlet.widgets.model.GridModelRow)103 UOW (org.jaffa.persistence.UOW)82 Criteria (org.jaffa.persistence.Criteria)66 DomainObjectNotFoundException (org.jaffa.exceptions.DomainObjectNotFoundException)59 MandatoryFieldException (org.jaffa.datatypes.exceptions.MandatoryFieldException)23 ValidationException (org.jaffa.datatypes.ValidationException)21 Iterator (java.util.Iterator)16 InvocationTargetException (java.lang.reflect.InvocationTargetException)15 Method (java.lang.reflect.Method)15 FormTemplate (org.jaffa.modules.printing.domain.FormTemplate)15 DuplicateKeyException (org.jaffa.exceptions.DuplicateKeyException)14 OutputCommand (org.jaffa.modules.printing.domain.OutputCommand)11 MalformedURLException (java.net.MalformedURLException)10 UserRequest (org.jaffa.applications.jaffa.modules.user.domain.UserRequest)10 PrinterDefinition (org.jaffa.modules.printing.domain.PrinterDefinition)10