Search in sources :

Example 46 with FrameworkException

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

the class DefaultValueEditorAction method do_Refresh_Clicked.

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

Example 47 with FrameworkException

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

the class LabelEditorComponent method retrieveLabels.

/**
 * This retrieves the labels from ApplicationResources.properties and the default and override files.
 * It then populates the 'labels' Map.
 * @throws FrameworkException if any error occurs.
 */
protected void retrieveLabels() throws FrameworkException {
    // clear the widget cache
    getUserSession().getWidgetCache(getComponentId()).clear();
    // The main map, which will contain Map objects keyed by the label
    m_labels = new LinkedHashMap();
    if (getLabelFilter() != null || (getDisplayOverridesOnly() != null && getDisplayOverridesOnly().booleanValue())) {
        try {
            Properties applicationResourcesDefaultProperties = null;
            Properties applicationResourcesOverrideProperties = null;
            String localeKey = localeKey(LocaleContext.getLocale());
            if (ApplicationResourceLoader.getApplicationResourcesManager().getApplicationResourcesLocaleRepository().query(localeKey) != null) {
                applicationResourcesDefaultProperties = ApplicationResourceLoader.getInstance().getApplicationResourcesLocale(localeKey);
                applicationResourcesOverrideProperties = ApplicationResourceLoader.getInstance().getApplicationResourcesOverride(localeKey);
            } else {
                applicationResourcesDefaultProperties = ApplicationResourceLoader.getInstance().getApplicationResourcesDefault();
                applicationResourcesOverrideProperties = ApplicationResourceLoader.getInstance().getApplicationResourcesOverride(null);
            }
            if (applicationResourcesDefaultProperties == null || applicationResourcesDefaultProperties.size() < 1 || applicationResourcesOverrideProperties == null) {
                String str = "There is no default, override properties. The Label Editor component cannot be used";
                log.error(str);
                throw new LabelEditorException(LabelEditorException.CONFIG_ERROR);
            }
            for (Enumeration defaultLabels = applicationResourcesDefaultProperties.propertyNames(); defaultLabels.hasMoreElements(); ) {
                String label = (String) defaultLabels.nextElement();
                // The label should match the labelFilter, if specified
                if (getLabelFilter() != null && !label.matches(getLabelFilter()))
                    continue;
                // The label should be overridden, if the 'displayOverridesOnly' property is true
                if (getDisplayOverridesOnly() != null && getDisplayOverridesOnly().booleanValue() && !applicationResourcesOverrideProperties.containsKey(label))
                    continue;
                final Map<String, String> map = new HashMap();
                map.put(DEFAULT, getEncodingValue(applicationResourcesDefaultProperties, label));
                map.put(OVERRIDE, getEncodingValue(applicationResourcesOverrideProperties, label));
                m_labels.put(label, map);
                // But do that only if a filter is specified and if the 'displayOverridesOnly' property is false
                if (getLabelFilter() != null && (getDisplayOverridesOnly() == null || !getDisplayOverridesOnly().booleanValue()))
                    addInnerTokens(map.get(DEFAULT), m_labels, applicationResourcesDefaultProperties, applicationResourcesOverrideProperties);
            }
        } catch (Exception e) {
            String str = "Exception thrown while reading the ApplicationResources default and override files";
            log.error(str, e);
            throw new LabelEditorException(LabelEditorException.READ_FAILED, null, e);
        }
    }
}
Also used : LabelEditorException(org.jaffa.applications.jaffa.modules.admin.components.labeleditor.ui.exceptions.LabelEditorException) ListProperties(org.jaffa.util.ListProperties) FrameworkException(org.jaffa.exceptions.FrameworkException) LabelEditorException(org.jaffa.applications.jaffa.modules.admin.components.labeleditor.ui.exceptions.LabelEditorException)

Example 48 with FrameworkException

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

the class Log4jConfigAction method do_Save_Clicked.

/**
 * Event Handler for the 'Save' clicked event.
 * This will copy the values from the Form to the Component and then invoke the performSave() method on the component.
 * Finally it'll get the latest file contents of the log4j xml file.
 * @return the FormKey for this screen.
 */
public FormKey do_Save_Clicked() {
    FormKey fk = null;
    Log4jConfigForm myForm = (Log4jConfigForm) form;
    Log4jConfigComponent myComp = (Log4jConfigComponent) component;
    try {
        // Copy the values from Form to Component
        myForm.doValidate();
        // save the file contents
        myComp.performSave();
        // Get the latest values
        fk = do_Refresh_Clicked();
    } 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.getLog4jConfigFormKey();
    return fk;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FrameworkException(org.jaffa.exceptions.FrameworkException) FormKey(org.jaffa.presentation.portlet.FormKey)

Example 49 with FrameworkException

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

the class RolesEditorAction method do_CheckPolicy_Clicked.

/**
 * This will re-render the screen with the original values.
 * @return the FormKey for this screen.
 */
public FormKey do_CheckPolicy_Clicked() {
    FormKey fk = null;
    RolesEditorForm myForm = (RolesEditorForm) form;
    RolesEditorComponent myComp = (RolesEditorComponent) component;
    try {
        fk = myComp.runCheckPolicy();
    } 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.getRolesEditorFormKey();
    return fk;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) FrameworkException(org.jaffa.exceptions.FrameworkException) FormKey(org.jaffa.presentation.portlet.FormKey)

Example 50 with FrameworkException

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

the class RolesEditorAction method do_Save_Clicked.

/**
 * Event Handler for the 'Save' clicked event.
 * This will copy the values from the Form to the Component and then invoke the performSave() method on the component.
 * Finally it'll get the latest file contents of the roles.xml file.
 * @return the FormKey for this screen.
 */
public FormKey do_Save_Clicked() {
    FormKey fk = null;
    RolesEditorForm myForm = (RolesEditorForm) form;
    RolesEditorComponent myComp = (RolesEditorComponent) component;
    try {
        // Copy the values from Form to Component
        myForm.doValidate();
        // save the file contents
        myComp.performSave(request);
        // Get the latest values
        fk = do_Refresh_Clicked();
    } 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.getRolesEditorFormKey();
    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