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;
}
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);
}
}
}
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;
}
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;
}
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;
}
Aggregations