Search in sources :

Example 1 with PersistenceException

use of net.sourceforge.processdash.ev.ui.TaskScheduleChartSettings.PersistenceException in project processdash by dtuma.

the class TaskScheduleChartUtil method getParameters.

/**
     * Get the parameters that should be passed to an EV Chart snippet widget.
     * 
     * @throws PersistenceException
     *             if the parameters for this settings object cannot be
     *             read/parsed
     */
public static Map getParameters(TaskScheduleChartSettings settings) throws PersistenceException {
    Map result = new HashMap();
    if (settings != null) {
        try {
            result.putAll(settings.getParameters());
            result.put(EVSnippetEnvironment.SNIPPET_VERSION, settings.getChartVersion());
            result.put(EVSnippetEnvironment.EV_CUSTOM_SNIPPET_NAME_KEY, settings.getCustomName());
        } catch (PersistenceException pe) {
            // the exception.
            if (settings.getCustomName() != null)
                throw pe;
            // otherwise, if this is a standard chart and the
            // saved settings can't be read, revert back to the
            // default settings provided by that chart.
            logger.log(Level.SEVERE, "Unexpected problem reading " + "settings for chart with id '" + settings.getChartID() + "' - reverting to defaults", pe);
            result = new HashMap();
        }
    }
    return result;
}
Also used : HashMap(java.util.HashMap) PersistenceException(net.sourceforge.processdash.ev.ui.TaskScheduleChartSettings.PersistenceException) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 PersistenceException (net.sourceforge.processdash.ev.ui.TaskScheduleChartSettings.PersistenceException)1