Search in sources :

Example 1 with GetQueryDataException

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

the class FinderComponent2 method generateFieldValuesMap.

/**
 * generateFieldValuesMap
 * @param fields to save values of
 * @return of fields and values
 * @throws GetQueryDataException
 */
private Map generateFieldValuesMap(List fields) throws GetQueryDataException {
    Map retVal = new HashMap();
    Iterator fieldsIterator = fields.iterator();
    while (fieldsIterator.hasNext()) {
        String fieldName = (String) fieldsIterator.next();
        try {
            retVal.put(fieldName, BeanHelper.getField(this, fieldName));
        } catch (NoSuchMethodException e) {
            log.error("NoSuchMethodException getting " + fieldName, e);
            throw new GetQueryDataException(e);
        }
    }
    return retVal;
}
Also used : GetQueryDataException(org.jaffa.exceptions.GetQueryDataException)

Example 2 with GetQueryDataException

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

the class FinderComponent2 method deleteQuery.

/**
 * deleteQuery
 *
 * @throws ApplicationException
 *
 * Deletes the currntly selected saved query
 */
public void deleteQuery() throws ApplicationException {
    if (getSavedQueryId() != null) {
        IContextManager contextManager = ContextManagerFactory.instance();
        QuerySaver querySaver = new QuerySaver(contextManager);
        try {
            querySaver.removeSavedQuery(getComponentDefinition().getComponentName(), getSavedQueryId().toString());
        } catch (IOException e) {
            log.error("IOError removing Queries ", e);
            throw new GetQueryDataException(e);
        }
    }
    initializeSavedQueries();
    getUserSession().getWidgetCache(getComponentId()).clear();
}
Also used : IOException(java.io.IOException) GetQueryDataException(org.jaffa.exceptions.GetQueryDataException) IContextManager(org.jaffa.session.IContextManager)

Example 3 with GetQueryDataException

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

the class FinderComponent2 method saveQuery.

/**
 * saveQuery
 * @throws ApplicationException
 *
 * Saves the current query
 */
public void saveQuery() throws ApplicationException {
    Map queryData = null;
    queryData = getQueryData();
    queryData.putAll(getCommonQueryData());
    try {
        IContextManager contextManager = ContextManagerFactory.instance();
        QuerySaver querySaver = new QuerySaver(contextManager);
        querySaver.saveQuery(getNewQueryName(), this.getComponentDefinition().getComponentName(), queryData, getDefaultQueryYn().booleanValue(), getQueryHasShortcutYn().booleanValue());
    } catch (IOException e) {
        log.error("IOError saving Queries ", e);
        throw new GetQueryDataException(e);
    }
    initializeSavedQueries();
    getUserSession().getWidgetCache(getComponentId()).clear();
}
Also used : IOException(java.io.IOException) GetQueryDataException(org.jaffa.exceptions.GetQueryDataException) IContextManager(org.jaffa.session.IContextManager)

Aggregations

GetQueryDataException (org.jaffa.exceptions.GetQueryDataException)3 IOException (java.io.IOException)2 IContextManager (org.jaffa.session.IContextManager)2