use of org.jaffa.session.IContextManager in project jaffa-framework by jaffa-projects.
the class FinderComponent2 method loadDefaultQuery.
public void loadDefaultQuery() throws ApplicationException {
IContextManager contextManager = ContextManagerFactory.instance();
QuerySaver querySaver = new QuerySaver(contextManager);
String defaultQueryId = querySaver.getDefaultQueryId(this.getComponentDefinition().getComponentName());
if (defaultQueryId != null) {
setSavedQueryId(new Long(defaultQueryId));
loadQuery();
} else {
throw new QueryNotFoundException("Default Query");
}
}
use of org.jaffa.session.IContextManager in project jaffa-framework by jaffa-projects.
the class FinderComponent2 method retrieveQueryTypes.
/**
* Returns a map of query ids and their export type. Is used by UI to determine if results should be opened in a new window.
* @return Map containing export types for saved queries.
*/
public Map<String, String> retrieveQueryTypes() {
/*
* Read the stored queries and create map
* this can be used to determine export type
*/
// Get the saved Queries
Map<String, String> queryTypes = null;
IContextManager contextManager = ContextManagerFactory.instance();
QuerySaver querySaver = new QuerySaver(contextManager);
Map savedQueries = querySaver.getSavedQueryList(getComponentDefinition().getComponentName());
if (savedQueries.size() > 0) {
queryTypes = new HashMap<String, String>();
Iterator savedQueriesIterator = savedQueries.keySet().iterator();
while (savedQueriesIterator.hasNext()) {
String element = (String) savedQueriesIterator.next();
Map queryFields = querySaver.getSavedQueryFields(getComponentDefinition().getComponentName(), element);
String type = (String) queryFields.get("ExportType");
queryTypes.put(element, type);
}
}
return queryTypes;
}
use of org.jaffa.session.IContextManager 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();
}
use of org.jaffa.session.IContextManager 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();
}
use of org.jaffa.session.IContextManager in project jaffa-framework by jaffa-projects.
the class QuerySaver method removeShortcutFlag.
public static void removeShortcutFlag(String componentName, String savedQueryId) throws IOException {
IContextManager contextManager = ContextManagerFactory.instance();
QuerySaver qs = new QuerySaver(contextManager);
qs.removeSavedQueryShortcut(componentName, savedQueryId);
}
Aggregations