Search in sources :

Example 16 with FrameworkException

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

the class FormEventMaintenanceTx method create.

// .//GEN-END:_prevalidateCreate_1_be
// .//GEN-BEGIN:_create_1_be
/**
 * Persists a new instance of FormEvent.
 * @param input The new values for the domain object.
 * @throws ApplicationExceptions This will be thrown if the input contains invalid data.
 * @throws FrameworkException Indicates some system error.
 * @return The object details.
 */
public FormEventMaintenanceRetrieveOutDto create(FormEventMaintenanceCreateInDto input) throws FrameworkException, ApplicationExceptions {
    UOW uow = null;
    try {
        // Print Debug Information for the input
        if (log.isDebugEnabled())
            log.debug("Input: " + (input != null ? input.toString() : null));
        // create the UOW
        uow = new UOW();
        // Preprocess the input
        preprocess(uow, input);
        // Do not allow a Duplicate record
        duplicateCheck(uow, input);
        // Validate the foreign objects
        validateForeignObjects(uow, input);
        // Create the domain object
        FormEvent domain = createDomain(uow, input, false);
        uow.add(domain);
        // Perform post create processing
        postCreate(uow, input, domain, false);
        // Commit the changes
        uow.commit();
        // Print Debug Information for the output
        if (log.isDebugEnabled())
            log.debug("Successfully created the domain object. Now retrieving the object details.");
        // Build the outbound dto by performing a retrieve
        FormEventMaintenanceRetrieveInDto retrieveInDto = new FormEventMaintenanceRetrieveInDto();
        retrieveInDto.setHeaderDto(input.getHeaderDto());
        retrieveInDto.setEventName(input.getEventName());
        FormEventMaintenanceRetrieveOutDto output = retrieve(retrieveInDto);
        return output;
    } catch (FrameworkException e) {
        // If it is, then re-throw as ApplicationsExceptions, else throw the FrameworkException.
        if (e.getCause() != null && e.getCause() instanceof ApplicationExceptions) {
            throw (ApplicationExceptions) e.getCause();
        } else if (e.getCause() != null && e.getCause() instanceof ApplicationException) {
            ApplicationExceptions appExps = new ApplicationExceptions();
            appExps.add((ApplicationException) e.getCause());
            throw appExps;
        } else
            throw e;
    } finally {
        if (uow != null)
            uow.rollback();
    }
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) ApplicationException(org.jaffa.exceptions.ApplicationException) FormEvent(org.jaffa.modules.printing.domain.FormEvent) FrameworkException(org.jaffa.exceptions.FrameworkException) UOW(org.jaffa.persistence.UOW)

Example 17 with FrameworkException

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

the class FormEventViewerAction method do_Delete_Clicked.

// .//GEN-END:_do_Update_Clicked_4_be
// .//GEN-BEGIN:_do_Delete_Clicked_1_be
/**
 * Invokes the deleteObject() method on the component.
 * @return The FormKey for the Delete screen.
 */
public FormKey do_Delete_Clicked() {
    FormKey fk = null;
    // .//GEN-END:_do_Delete_Clicked_1_be
    // Add custom code before processing the action //GEN-FIRST:_do_Delete_Clicked_1
    // .//GEN-LAST:_do_Delete_Clicked_1
    // .//GEN-BEGIN:_do_Delete_Clicked_2_be
    FormEventViewerForm myForm = (FormEventViewerForm) form;
    FormEventViewerComponent myComp = (FormEventViewerComponent) myForm.getComponent();
    try {
        // .//GEN-END:_do_Delete_Clicked_2_be
        // Add custom code before invoking the component //GEN-FIRST:_do_Delete_Clicked_2
        // .//GEN-LAST:_do_Delete_Clicked_2
        // .//GEN-BEGIN:_do_Delete_Clicked_3_be
        fk = myComp.deleteObject();
    } 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.getViewerFormKey();
    return fk;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FrameworkException(org.jaffa.exceptions.FrameworkException) FormKey(org.jaffa.presentation.portlet.FormKey)

Example 18 with FrameworkException

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

the class FormEventViewerAction method do_RelatedFormUsage_Update_Clicked.

// .//GEN-END:do_RelatedFormUsage_View_Clicked_4_be
// .//GEN-BEGIN:do_RelatedFormUsage_Update_Clicked_1_be
/**
 * Invokes the updateFormUsage() method on the component.
 * @param rowNum The selected row on the Grid.
 * @return The FormKey for the Update screen of the FormUsage object.
 */
public FormKey do_RelatedFormUsage_Update_Clicked(String rowNum) {
    FormKey fk = null;
    // .//GEN-END:do_RelatedFormUsage_Update_Clicked_1_be
    // Add custom code before processing the action //GEN-FIRST:do_RelatedFormUsage_Update_Clicked_1
    // .//GEN-LAST:do_RelatedFormUsage_Update_Clicked_1
    // .//GEN-BEGIN:do_RelatedFormUsage_Update_Clicked_2_be
    FormEventViewerForm myForm = (FormEventViewerForm) form;
    FormEventViewerComponent myComp = (FormEventViewerComponent) myForm.getComponent();
    GridModel model = (GridModel) myForm.getRelatedFormUsageWM();
    GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
    if (selectedRow != null) {
        try {
            // .//GEN-END:do_RelatedFormUsage_Update_Clicked_2_be
            // Add custom code before invoking the component //GEN-FIRST:do_RelatedFormUsage_Update_Clicked_2
            // .//GEN-LAST:do_RelatedFormUsage_Update_Clicked_2
            // .//GEN-BEGIN:do_RelatedFormUsage_Update_Clicked_3_be
            fk = myComp.updateFormUsage((java.lang.String) selectedRow.get("formName"));
        } catch (ApplicationExceptions e) {
            if (log.isDebugEnabled())
                log.debug("Updator 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-BEGIN:do_RelatedFormUsage_Update_Clicked_4_be
    if (fk == null)
        fk = new FormKey(myForm.NAME, myComp.getComponentId());
    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 FrameworkException

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

the class FormEventViewerAction method do_RelatedFormUsage_View_Clicked.

/**
 * Invokes the viewFormUsage() method on the component.
 * @param rowNum The selected row on the Grid.
 * @return The FormKey for the View screen of the FormUsage object.
 */
public FormKey do_RelatedFormUsage_View_Clicked(String rowNum) {
    FormKey fk = null;
    // .//GEN-END:do_RelatedFormUsage_View_Clicked_1_be
    // Add custom code before processing the action //GEN-FIRST:do_RelatedFormUsage_View_Clicked_1
    // .//GEN-LAST:do_RelatedFormUsage_View_Clicked_1
    // .//GEN-BEGIN:do_RelatedFormUsage_View_Clicked_2_be
    FormEventViewerForm myForm = (FormEventViewerForm) form;
    FormEventViewerComponent myComp = (FormEventViewerComponent) myForm.getComponent();
    GridModel model = (GridModel) myForm.getRelatedFormUsageWM();
    GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
    if (selectedRow != null) {
        try {
            // .//GEN-END:do_RelatedFormUsage_View_Clicked_2_be
            // Add custom code before invoking the component //GEN-FIRST:do_RelatedFormUsage_View_Clicked_2
            // .//GEN-LAST:do_RelatedFormUsage_View_Clicked_2
            // .//GEN-BEGIN:do_RelatedFormUsage_View_Clicked_3_be
            fk = myComp.viewFormUsage((java.lang.String) selectedRow.get("formName"));
        } 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_RelatedFormUsage_View_Clicked_3_be
    // Add custom code before returning //GEN-FIRST:do_RelatedFormUsage_View_Clicked_3
    // .//GEN-LAST:do_RelatedFormUsage_View_Clicked_3
    // .//GEN-BEGIN:do_RelatedFormUsage_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 = new FormKey(myForm.NAME, myComp.getComponentId());
    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 20 with FrameworkException

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

the class FormGroupFinderAction 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
    FormGroupFinderForm myForm = (FormGroupFinderForm) form;
    FormGroupFinderComponent myComp = (FormGroupFinderComponent) 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.String) selectedRow.get("formName"));
        } 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)

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