Search in sources :

Example 6 with FrameworkException

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

the class FormSelectionMaintenanceComponent method doUpdateDetail.

/**
 * Show the AdditionalData Component.
 * Pass the Additional Data Object if there is one.
 */
public FormKey doUpdateDetail(GridModelRow selectedRow, String actionPath) throws ApplicationExceptions, FrameworkException {
    FormKey fk = null;
    String additionalComponent = null;
    try {
        final FormSelectionMaintenanceOutRowDto rowDto = (FormSelectionMaintenanceOutRowDto) selectedRow.get("object");
        additionalComponent = rowDto.getAdditionalDataComponent();
        Component comp = (Component) run(additionalComponent);
        BeanUtils.setProperty(comp, getKey1(), getValue1());
        if (getKey2() != null) {
            BeanUtils.setProperty(comp, getKey2(), getValue2());
        }
        if (getKey3() != null) {
            BeanUtils.setProperty(comp, getKey3(), getValue3());
        }
        if (getKey4() != null) {
            BeanUtils.setProperty(comp, getKey4(), getValue4());
        }
        if (getKey5() != null) {
            BeanUtils.setProperty(comp, getKey5(), getValue5());
        }
        if (getKey6() != null) {
            BeanUtils.setProperty(comp, getKey6(), getValue6());
        }
        // implements IAdditionalDataObject.
        if (comp instanceof IAdditionalDataObject) {
            ((IAdditionalDataObject) comp).setAdditionalDataObject(rowDto.getAdditionalDataObject());
            ((IUpdateComponent) comp).addUpdateListener(new IUpdateListener() {

                public void updateDone(EventObject source) {
                    try {
                        rowDto.setAdditionalDataObject(((IAdditionalDataObject) source.getSource()).getAdditionalDataObject());
                    } catch (Exception e) {
                        log.warn("Error setting the Additional Data Object after the Update", e);
                    }
                }
            });
        }
        comp.setReturnToFormKey(getResultsFormKey());
        // Populate info to allow Web 2.0 component to return to this component
        if (comp instanceof RiaWrapperComponent) {
            RiaWrapperComponent c = (RiaWrapperComponent) comp;
            c.getParameters().setProperty("returnToActionPath", actionPath);
            c.getParameters().setProperty("returnToFormKey_componentId", comp.getReturnToFormKey().getComponentId());
        }
        fk = comp.display();
    } catch (SecurityException se) {
        log.error("SecurityException Occurred ", se);
        throw new ApplicationExceptions(new FormSelectionException(FormSelectionException.SECURITY_EXCEPTION));
    } catch (IllegalAccessException e) {
        log.error("IllegalAccessException Occurred ", e);
    } catch (InvocationTargetException e) {
        log.error("InvocationTargetException Occurred ", e);
    } catch (IllegalArgumentException e) {
        log.error("IllegalArgumentException Occurred ", e);
    } catch (ApplicationExceptions applicationException) {
        throw applicationException;
    } catch (FrameworkException frameworkException) {
        throw frameworkException;
    }
    return fk;
}
Also used : FormSelectionException(org.jaffa.modules.printing.components.formselectionmaintenance.FormSelectionException) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FrameworkException(org.jaffa.exceptions.FrameworkException) IAdditionalDataObject(org.jaffa.modules.printing.components.formselectionmaintenance.IAdditionalDataObject) RiaWrapperComponent(org.jaffa.presentation.portlet.component.RiaWrapperComponent) FormKey(org.jaffa.presentation.portlet.FormKey) FrameworkException(org.jaffa.exceptions.FrameworkException) FormSelectionException(org.jaffa.modules.printing.components.formselectionmaintenance.FormSelectionException) ApplicationException(org.jaffa.exceptions.ApplicationException) InvocationTargetException(java.lang.reflect.InvocationTargetException) MandatoryFieldException(org.jaffa.datatypes.exceptions.MandatoryFieldException) InvocationTargetException(java.lang.reflect.InvocationTargetException) FormSelectionMaintenanceOutRowDto(org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceOutRowDto) Component(org.jaffa.presentation.portlet.component.Component) RiaWrapperComponent(org.jaffa.presentation.portlet.component.RiaWrapperComponent)

Example 7 with FrameworkException

use of org.jaffa.exceptions.FrameworkException 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 8 with FrameworkException

use of org.jaffa.exceptions.FrameworkException 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 9 with FrameworkException

use of org.jaffa.exceptions.FrameworkException 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 10 with FrameworkException

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

the class FormTemplateLookupAction method do_Rows_Update_Clicked.

// .//GEN-END:_do_Rows_View_Clicked_4_be
// .//GEN-BEGIN:_do_Rows_Update_Clicked_1_be
/**
 * Invokes the updateObject() method on the component.
 * @param rowNum The selected row on the Results screen.
 * @return The FormKey for the Update screen.
 */
public FormKey do_Rows_Update_Clicked(String rowNum) {
    FormKey fk = null;
    // .//GEN-END:_do_Rows_Update_Clicked_1_be
    // Add custom code before processing the action //GEN-FIRST:_do_Rows_Update_Clicked_1
    // .//GEN-LAST:_do_Rows_Update_Clicked_1
    // .//GEN-BEGIN:_do_Rows_Update_Clicked_2_be
    FormTemplateLookupForm myForm = (FormTemplateLookupForm) form;
    FormTemplateLookupComponent myComp = (FormTemplateLookupComponent) myForm.getComponent();
    GridModel model = (GridModel) myForm.getRowsWM();
    GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
    if (selectedRow != null) {
        try {
            // .//GEN-END:_do_Rows_Update_Clicked_2_be
            // Add custom code before invoking the component //GEN-FIRST:_do_Rows_Update_Clicked_2
            // .//GEN-LAST:_do_Rows_Update_Clicked_2
            // .//GEN-BEGIN:_do_Rows_Update_Clicked_3_be
            fk = myComp.updateObject((java.lang.Long) selectedRow.get("formId"));
        } catch (ApplicationExceptions e) {
            if (log.isDebugEnabled())
                log.debug("Update 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)

Aggregations

FrameworkException (org.jaffa.exceptions.FrameworkException)348 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)293 FormKey (org.jaffa.presentation.portlet.FormKey)204 ApplicationException (org.jaffa.exceptions.ApplicationException)101 GridModel (org.jaffa.presentation.portlet.widgets.model.GridModel)100 GridModelRow (org.jaffa.presentation.portlet.widgets.model.GridModelRow)99 UOW (org.jaffa.persistence.UOW)87 InvocationTargetException (java.lang.reflect.InvocationTargetException)16 Method (java.lang.reflect.Method)14 DomainObjectNotFoundException (org.jaffa.exceptions.DomainObjectNotFoundException)12 Iterator (java.util.Iterator)11 IPersistent (org.jaffa.persistence.IPersistent)10 Map (java.util.Map)9 FormTemplate (org.jaffa.modules.printing.domain.FormTemplate)9 Criteria (org.jaffa.persistence.Criteria)9 LinkedHashMap (java.util.LinkedHashMap)7 Attachment (org.jaffa.components.attachment.domain.Attachment)6 InvalidForeignKeyException (org.jaffa.datatypes.exceptions.InvalidForeignKeyException)6 MultipleDomainObjectsFoundException (org.jaffa.exceptions.MultipleDomainObjectsFoundException)6 FormDefinition (org.jaffa.modules.printing.domain.FormDefinition)6