Search in sources :

Example 51 with FrameworkException

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

the class ValidationRulesEditorAction method do_Save_Clicked.

/**
 * Clicked event handler for the field Save.
 * @return The FormKey.
 */
public FormKey do_Save_Clicked() {
    FormKey fk = null;
    ValidationRulesEditorForm myForm = (ValidationRulesEditorForm) form;
    ValidationRulesEditorComponent myComp = (ValidationRulesEditorComponent) myForm.getComponent();
    try {
        // Copy the values from Form to Component
        myForm.doValidate(request);
        // save the file contents
        myComp.performSave();
    } catch (ApplicationExceptions e) {
        myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
    } catch (FrameworkException e) {
        log.error(null, e);
        myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
    }
    if (fk == null)
        fk = myComp.determineFormKey();
    return fk;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FrameworkException(org.jaffa.exceptions.FrameworkException) FormKey(org.jaffa.presentation.portlet.FormKey)

Example 52 with FrameworkException

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

the class ValidationRulesEditorAction method do_CoreRulesUrl_Clicked.

/**
 * Invoked if the core-rules URL is clicked
 * @return The FormKey for the Update screen.
 */
public FormKey do_CoreRulesUrl_Clicked() {
    ValidationRulesEditorForm myForm = (ValidationRulesEditorForm) form;
    ValidationRulesEditorComponent myComp = (ValidationRulesEditorComponent) myForm.getComponent();
    FormKey fk = null;
    try {
        String fileName = (String) Config.getProperty(Config.PROP_RULES_ENGINE_CORE_RULES_URL, null);
        if (!fileName.equals(myComp.getValidationRulesFile())) {
            myComp.setFileContents(null);
            myComp.setValidationRulesFile(fileName);
            myComp.loadFileContents();
        }
        myComp.determineAndSetNextScreen();
    } catch (ApplicationExceptions e) {
        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.determineFormKey();
    return fk;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FrameworkException(org.jaffa.exceptions.FrameworkException) FormKey(org.jaffa.presentation.portlet.FormKey)

Example 53 with FrameworkException

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

the class ValidationRulesEditorAction method do_ValidatorsUrls_Update_Clicked.

/**
 * Invoked if a update button on a row is selected.
 * @param rowId The selected row on the screen.
 * @return The FormKey for the Update screen.
 */
public FormKey do_ValidatorsUrls_Update_Clicked(String rowId) {
    ValidationRulesEditorForm myForm = (ValidationRulesEditorForm) form;
    ValidationRulesEditorComponent myComp = (ValidationRulesEditorComponent) myForm.getComponent();
    FormKey fk = null;
    GridModel model = (GridModel) myForm.getValidatorsUrlsWM();
    GridModelRow selectedRow = model.getRowById(Integer.parseInt(rowId));
    if (selectedRow != null) {
        try {
            String fileName = (String) selectedRow.get("validatorsUrl");
            if (!fileName.equals(myComp.getValidationRulesFile())) {
                myComp.setFileContents(null);
                myComp.setValidationRulesFile(fileName);
                myComp.loadFileContents();
            }
            myComp.determineAndSetNextScreen();
        } catch (ApplicationExceptions e) {
            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.determineFormKey();
    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 54 with FrameworkException

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

the class ValidationRulesEditorAction method do_Rules_Update_Clicked.

/**
 * Invoked if a update button on a row is selected.
 * @param rowId The selected row on the screen.
 * @return The FormKey for the Update screen.
 */
public FormKey do_Rules_Update_Clicked(String rowId) {
    ValidationRulesEditorForm myForm = (ValidationRulesEditorForm) form;
    ValidationRulesEditorComponent myComp = (ValidationRulesEditorComponent) myForm.getComponent();
    FormKey fk = null;
    GridModel model = (GridModel) myForm.getRulesWM();
    GridModelRow selectedRow = model.getRowById(Integer.parseInt(rowId));
    if (selectedRow != null) {
        try {
            String fileName = (String) selectedRow.get("name");
            if (!fileName.equals(myComp.getValidationRulesFile())) {
                myComp.setFileContents(null);
                myComp.setValidationRulesFile(fileName);
                myComp.loadFileContents();
            }
            myComp.determineAndSetNextScreen();
        } catch (ApplicationExceptions e) {
            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.determineFormKey();
    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 55 with FrameworkException

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

the class ValidationRulesEditorAction method do_Refresh_Clicked.

/**
 * Clicked event handler for the field Refresh.
 * @return The FormKey.
 */
public FormKey do_Refresh_Clicked() {
    FormKey fk = null;
    ValidationRulesEditorForm myForm = (ValidationRulesEditorForm) form;
    ValidationRulesEditorComponent myComp = (ValidationRulesEditorComponent) myForm.getComponent();
    myComp.setFileContents(null);
    try {
        myComp.loadFileContents();
    } catch (ApplicationExceptions e) {
        myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
    } catch (FrameworkException e) {
        log.error(null, e);
        myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
    }
    if (fk == null)
        fk = myComp.determineFormKey();
    return fk;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FrameworkException(org.jaffa.exceptions.FrameworkException) FormKey(org.jaffa.presentation.portlet.FormKey)

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