/** @param _parameter */ public Return execute(final Parameter _parameter) throws EFapsException { Return ret = new Return(); Map properties = (Map) _parameter.get(ParameterValues.PROPERTIES); String types = (String) properties.get("Types"); boolean expandChildTypes = "true".equals((String) properties.get("ExpandChildTypes")); if (LOG.isDebugEnabled()) { LOG.debug("types=" + types); } SearchQuery query = new SearchQuery(); query.setQueryTypes(types); query.setExpandChildTypes(expandChildTypes); query.addSelect("OID"); query.execute(); List<List<Instance>> list = new ArrayList<List<Instance>>(); while (query.next()) { List<Instance> instances = new ArrayList<Instance>(1); instances.add(new Instance((String) query.get("OID"))); list.add(instances); } ret.put(ReturnValues.VALUES, list); return ret; }
/** * Searches for the given name the xsl in eFaps. If exists, the instance is returned. * * @return found instance (or null if not found) * @throws EFapsException if search query could not be executed * @see #programName */ @Override public Instance searchInstance() throws EFapsException { Instance instance = null; final Type esjpType = Type.get(ADMIN_PROGRAM_XSL); final SearchQuery query = new SearchQuery(); query.setQueryTypes(esjpType.getName()); query.addWhereExprEqValue("Name", getProgramName()); query.addSelect("OID"); query.executeWithoutAccessCheck(); if (query.next()) { instance = Instance.get((String) query.get("OID")); } query.close(); return instance; }
/** * Searches for an existing Stopword with the parameters as a filter and returns the ID of the * StopWord * * @param _AnalyzerID ID of a Lucene_Analyzer * @param _Word StopWord * @return ID if exits, else null */ private static String getIDofExistingStopWord(String _AnalyzerID, String _Word) { SearchQuery query = new SearchQuery(); try { query.setQueryTypes("Lucene_StopWords"); query.addSelect("ID"); query.addWhereExprEqValue("Word", _Word); query.addWhereExprEqValue("Analyzer", _AnalyzerID); query.execute(); if (query.next()) { return query.get("ID").toString(); } } catch (EFapsException e) { LOG.error("getIDofExistingStopWord(String, String)", e); } return null; }
/** * Reads all StopWords which are linked to an <b>Lucene_Analyzer</b> from the Database and returns * a Set of Stopwords * * @param _AnalyzerID the ID of an Lucene_Analyzer * @return Set of Stopwords */ public static Set getStopWords(String _AnalyzerID) { Set<String> StopWords = new HashSet<String>(); SearchQuery query = new SearchQuery(); try { query.setQueryTypes("Lucene_StopWords"); query.addSelect("Word"); query.addWhereExprEqValue("Analyzer", _AnalyzerID); query.execute(); while (query.next()) { StopWords.add(query.get("Word").toString()); } return StopWords; } catch (EFapsException e) { LOG.error("getStopWords(String)", e); } return null; }