List of usage examples for java.util StringTokenizer countTokens
public int countTokens()
From source file:free.chessclub.bot.Bot.java
/** * Processes personal tells. If the tell type is TELL, this method parses the * message and delegates to processCommand. Otherwise, the tell is ignored. *//*from w w w . java 2s.c om*/ protected void processPersonalTell(String playerName, String titles, String message, int tellType) { /* if (tellType!=TELL) return; */ StringTokenizer tokenizer = new StringTokenizer(message, " \"\'", true); String[] tokens = new String[tokenizer.countTokens()]; int numTokens = 0; try { while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); if (token.equals("\"") || token.equals("\'")) { tokens[numTokens++] = tokenizer.nextToken(token); tokenizer.nextToken(" \"\'"); // Get rid of the string terminating quote. } else if (!token.equals(" ")) tokens[numTokens++] = token; } } catch (NoSuchElementException e) { sendTell(playerName, "Unterminated string literal"); return; } if (numTokens == 0) { sendTell(playerName, "You must specify a command"); return; } String issuedCommand = tokens[0]; String[] args = new String[numTokens - 1]; System.arraycopy(tokens, 1, args, 0, args.length); CommandEvent command = new CommandEvent(this, issuedCommand, args, message, playerName, titles); processCommand(command); }
From source file:ch.bfh.evoting.alljoyn.BusHandler.java
/** * Helper method extracting an identity from a received message * @param messageObject the original message received */// www.j av a2s. co m private void extractIdentity(AllJoynMessage messageObject) { Log.d(TAG, "Exctracting identity " + messageObject.getMessage()); //Get the name and its corresponding key key StringTokenizer tokenizer = new StringTokenizer(messageObject.getMessage(), MESSAGE_PARTS_SEPARATOR); if (tokenizer.countTokens() != 2) { //malformed string Log.d(TAG, "String was not composed of 2 parts"); return; } String peerId = messageObject.getSender(); //then peerName String peerName = (String) tokenizer.nextElement(); //and finally peerKey String peerKey = (String) tokenizer.nextElement(); Identity newIdentity = new Identity(peerName, messageAuthenticater.decodePublicKey(peerKey)); //Check if identity is already known if (identityMap.containsKey(peerId)) { //if yes, check if the same identity as received before if (!identityMap.get(peerId).equals(newIdentity)) { //If not someone is trying to impersonate somebody else Intent intent = new Intent("attackDetected"); intent.putExtra("type", 1); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); Log.e(TAG, "Two different data received for peer " + peerId); return; } } else { boolean verification = messageObject.verifyMessage(newIdentity.getPublicKey()); if (verification) { //Save the new identity Log.d(TAG, "identity received " + newIdentity.getName()); identityMap.put(peerId, newIdentity); this.sendMyIdentity(); //Update the UI LocalBroadcastManager.getInstance(context).sendBroadcast(new Intent("participantStateUpdate")); if (peerId.equals(signatureVerificationTask.getSender())) { verifySignatureSalt(); } } else { Log.e(TAG, "Wrong signature for identiy message from " + peerId); return; } } }
From source file:gov.nih.nci.cabig.caaers.web.admin.OrganizationImporter.java
/** * This method accepts a String which should be like * "CA531","California Hematology Oncology Medical Group","Torrance","CA","USA" * It splits the string into 5 tokens and creates a LocalOrganization object. * If the number of token are less than 5 the record/line is rejected. * @param organizationString//from w w w .jav a2 s .c o m * @return */ protected DomainObjectImportOutcome<Organization> processOrganization(String organizationString, int lineNumber) { DomainObjectImportOutcome<Organization> organizationImportOutcome = null; LocalOrganization localOrganization = null; StringTokenizer st = null; String institutionCode; String institutionName; String city; String state; String country; if (StringUtils.isNotEmpty(organizationString)) { logger.debug("Orginial line from file -- >>> " + organizationString); organizationString = organizationString.trim(); //Replace ", with "| //This is done to set a delimiter other than , organizationString = StringUtils.replace(organizationString, "\",", "\"|"); logger.debug("Modified line -- >>> " + organizationString); //Generate tokens from input String. st = new StringTokenizer(organizationString, "|"); //If there are 5 tokens as expected, process the record. Create a LocalOrganization object. if (st.hasMoreTokens() && st.countTokens() == 5) { organizationImportOutcome = new DomainObjectImportOutcome<Organization>(); localOrganization = new LocalOrganization(); institutionCode = StringUtils.removeStart(st.nextToken(), "\"").trim(); institutionCode = StringUtils.removeEnd(institutionCode, "\""); institutionName = StringUtils.removeStart(st.nextToken(), "\"").trim(); institutionName = StringUtils.removeEnd(institutionName, "\""); city = StringUtils.removeStart(st.nextToken(), "\"").trim(); city = StringUtils.removeEnd(city, "\""); state = StringUtils.removeStart(st.nextToken(), "\"").trim(); state = StringUtils.removeEnd(state, "\""); country = StringUtils.removeStart(st.nextToken(), "\"").trim(); country = StringUtils.removeEnd(country, "\""); localOrganization.setName(institutionName); localOrganization.setNciInstituteCode(institutionCode); localOrganization.setCity(city); localOrganization.setState(state); localOrganization.setCountry(country); organizationImportOutcome.setImportedDomainObject(localOrganization); organizationImportOutcome.setSavable(Boolean.TRUE); } else { logger.debug("Error in record -- >>> " + organizationString); organizationImportOutcome = new DomainObjectImportOutcome<Organization>(); StringBuilder msgBuilder = new StringBuilder("Invalid organization record found at line ::: "); msgBuilder.append(lineNumber); organizationImportOutcome.addErrorMessage(msgBuilder.toString(), Severity.ERROR); } } return organizationImportOutcome; }
From source file:jp.terasoluna.fw.web.struts.form.FieldChecksEx.java
/** * ??[?\bhn?NXz?B//from w w w . j a va 2 s . c o m * * <b>?\bhANVtH?[? tH?[O?Ap?s???B</b> * * @param va * Strutsp<code>ValidatorAction</code> * @return ?NXz */ protected static Class[] getParamClass(ValidatorAction va) { String methodParams = va.getMethodParams(); if (methodParams == null) { return null; } StringTokenizer st = new StringTokenizer(methodParams, ","); Class[] paramClass = new Class[st.countTokens()]; for (int i = 0; st.hasMoreTokens(); i++) { try { String key = st.nextToken().trim(); paramClass[i] = ClassUtils.getClass(key); } catch (ClassNotFoundException e) { log.error("", e); return null; } } return paramClass; }
From source file:org.alfresco.repo.security.authentication.ntlm.NTLMAuthenticationComponentImpl.java
/** * Set the protocol order for passthru connections * //w ww.j a va2s .c o m * @param protoOrder String */ public void setProtocolOrder(String protoOrder) { // Parse the protocol order list StringTokenizer tokens = new StringTokenizer(protoOrder, ","); int primaryProto = Protocol.None; int secondaryProto = Protocol.None; // There should only be one or two tokens if (tokens.countTokens() > 2) throw new AlfrescoRuntimeException("Invalid protocol order list, " + protoOrder); // Get the primary protocol if (tokens.hasMoreTokens()) { // Parse the primary protocol String primaryStr = tokens.nextToken(); if (primaryStr.equalsIgnoreCase("TCPIP")) primaryProto = Protocol.NativeSMB; else if (primaryStr.equalsIgnoreCase("NetBIOS")) primaryProto = Protocol.TCPNetBIOS; else throw new AlfrescoRuntimeException("Invalid protocol type, " + primaryStr); // Check if there is a secondary protocol, and validate if (tokens.hasMoreTokens()) { // Parse the secondary protocol String secondaryStr = tokens.nextToken(); if (secondaryStr.equalsIgnoreCase("TCPIP") && primaryProto != Protocol.NativeSMB) secondaryProto = Protocol.NativeSMB; else if (secondaryStr.equalsIgnoreCase("NetBIOS") && primaryProto != Protocol.TCPNetBIOS) secondaryProto = Protocol.TCPNetBIOS; else throw new AlfrescoRuntimeException("Invalid secondary protocol, " + secondaryStr); } } // Set the protocol order used for passthru authentication sessions AuthSessionFactory.setProtocolOrder(primaryProto, secondaryProto); // DEBUG if (logger.isDebugEnabled()) { logger.debug("Protocol order primary=" + Protocol.asString(primaryProto) + ", secondary=" + Protocol.asString(secondaryProto)); } }
From source file:de.tor.tribes.ui.views.DSWorkbenchSelectionFrame.java
private void copyBBToExternalClipboardEvent() { try {/*from w w w. jav a2 s.co m*/ List<Village> selection = getSelectedElements(); if (selection.isEmpty()) { showInfo("Keine Elemente ausgewhlt"); return; } boolean extended = (JOptionPaneHelper.showQuestionConfirmBox(this, "Erweiterte BB-Codes verwenden (nur fr Forum und Notizen geeignet)?", "Erweiterter BB-Code", "Nein", "Ja") == JOptionPane.YES_OPTION); StringBuilder buffer = new StringBuilder(); if (extended) { buffer.append("[u][size=12]Dorfliste[/size][/u]\n\n"); } else { buffer.append("[u]Dorfliste[/u]\n\n"); } buffer.append(new VillageListFormatter().formatElements(selection, extended)); if (extended) { buffer.append("\n[size=8]Erstellt am "); buffer.append( new SimpleDateFormat("dd.MM.yy 'um' HH:mm:ss").format(Calendar.getInstance().getTime())); buffer.append(" mit DS Workbench "); buffer.append(Constants.VERSION).append(Constants.VERSION_ADDITION + "[/size]\n"); } else { buffer.append("\nErstellt am "); buffer.append( new SimpleDateFormat("dd.MM.yy 'um' HH:mm:ss").format(Calendar.getInstance().getTime())); buffer.append(" mit DS Workbench "); buffer.append(Constants.VERSION).append(Constants.VERSION_ADDITION + "\n"); } String b = buffer.toString(); StringTokenizer t = new StringTokenizer(b, "["); int cnt = t.countTokens(); if (cnt > 1000) { if (JOptionPaneHelper.showQuestionConfirmBox(this, "Die ausgewhlten Drfer bentigen mehr als 1000 BB-Codes\n" + "und knnen daher im Spiel (Forum/IGM/Notizen) nicht auf einmal dargestellt werden.\nTrotzdem exportieren?", "Zu viele BB-Codes", "Nein", "Ja") == JOptionPane.NO_OPTION) { return; } } Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(b), null); showSuccess("Daten in Zwischenablage kopiert"); } catch (Exception e) { logger.error("Failed to copy data to clipboard", e); showError("Fehler beim Kopieren in die Zwischenablage"); } }
From source file:es.pode.administracion.presentacion.informes.crearInforme.ListadoInformesAceptarFormImpl.java
/** * * @param items//from w w w. ja v a 2 s.co m * @param valueProperty * @param labelProperty */ public void setUsuariosBackingList(java.util.Collection items, java.lang.String valueProperty, java.lang.String labelProperty) { if (valueProperty == null || labelProperty == null) { throw new IllegalArgumentException( "ListadoInformesAceptarFormImpl.setUsuariosBackingList requires non-null property arguments"); } StringTokenizer strTnk = new StringTokenizer(labelProperty, ","); String[] labels = new String[strTnk.countTokens()]; int i = 0; while (strTnk.hasMoreTokens()) { labels[i++] = strTnk.nextToken(); } this.usuariosValueList = null; this.usuariosLabelList = null; if (items != null) { this.usuariosValueList = new java.lang.Object[items.size()]; this.usuariosLabelList = new java.lang.Object[items.size()]; try { i = 0; for (java.util.Iterator iterator = items.iterator(); iterator.hasNext(); i++) { final java.lang.Object item = iterator.next(); this.usuariosValueList[i] = org.apache.commons.beanutils.PropertyUtils.getProperty(item, valueProperty); /* * Changing labels */ String labelValue = ""; for (int j = 0; j < labels.length; j++) { labelValue = labelValue + org.apache.commons.beanutils.PropertyUtils.getProperty(item, labels[j]) + " "; } this.usuariosLabelList[i] = labelValue.trim(); } } catch (Exception ex) { throw new java.lang.RuntimeException( "ListadoInformesAceptarFormImpl.setUsuariosBackingList encountered an exception", ex); } } }
From source file:axiom.servlet.AbstractServletClient.java
String getPathInfo(HttpServletRequest req) throws UnsupportedEncodingException { StringTokenizer t = new StringTokenizer(req.getContextPath(), "/"); int prefixTokens = t.countTokens(); t = new StringTokenizer(req.getServletPath(), "/"); prefixTokens += t.countTokens();//from ww w . j a v a 2s . c om String uri = req.getRequestURI(); t = new StringTokenizer(uri, "/"); int uriTokens = t.countTokens(); StringBuffer pathbuffer = new StringBuffer(); String encoding = getApplication().getCharset(); for (int i = 0; i < uriTokens; i++) { String token = t.nextToken(); if (i < prefixTokens) { continue; } if (i > prefixTokens) { pathbuffer.append('/'); } pathbuffer.append(UrlEncoded.decode(token, encoding)); } // append trailing "/" if it is contained in original URI if (uri.endsWith("/")) pathbuffer.append('/'); return pathbuffer.toString(); }
From source file:org.alfresco.repo.web.scripts.bean.ADMRemoteStore.java
/** * @param path cm:name based root relative path * example: /alfresco/site-data/pages/customise-user-dashboard.xml * /alfresco/site-data/components * @param pattern optional pattern that is used as part of the match to aquire the surf-config * folder under the appropriate sites or user location. * @param create if true create the config and folder dirs for the given path returning * the FileInfo for the last parent in the path, if false only attempt to * resolve the folder path if it exists returning the last element. * @param isFolder True if the path is for a folder, false if it ends in a filename * /*from ww w.ja v a 2 s. co m*/ * @return FileInfo representing the file/folder at the specified path location (see create * parameter above) or null if the supplied path does not exist in the store. */ private FileInfo resolveNodePath(final String path, final String pattern, final boolean create, final boolean isFolder) { if (logger.isDebugEnabled()) logger.debug("Resolving path: " + path); final String adminUserName = AuthenticationUtil.getAdminUserName(); FileInfo result = null; if (path != null) { // break down the path into its component elements List<String> pathElements = new ArrayList<String>(4); final StringTokenizer t = new StringTokenizer(path, "/"); // the store requires paths of the form /alfresco/site-data/<objecttype>[/<folder>]/<file>.xml if (t.countTokens() >= 3) { t.nextToken(); // skip /alfresco t.nextToken(); // skip /site-data // collect remaining folder path (and file) while (t.hasMoreTokens()) { pathElements.add(t.nextToken()); } NodeRef surfConfigRef = aquireSurfConfigRef(path + (pattern != null ? ("/" + pattern) : ""), create); try { if (surfConfigRef != null) { if (create) { List<String> folders = isFolder ? pathElements : pathElements.subList(0, pathElements.size() - 1); List<FileFolderUtil.PathElementDetails> folderDetails = new ArrayList<>( pathElements.size()); Map<QName, Serializable> prop = new HashMap<>(2); prop.put(ContentModel.PROP_IS_INDEXED, false); prop.put(ContentModel.PROP_IS_CONTENT_INDEXED, false); for (String element : folders) { Map<QName, Map<QName, Serializable>> aspects = Collections .singletonMap(ContentModel.ASPECT_INDEX_CONTROL, prop); folderDetails.add(new FileFolderUtil.PathElementDetails(element, aspects)); } // ensure folders exist down to the specified parent // ALF-17729 / ALF-17796 - disable auditable on parent folders Set<NodeRef> allCreatedFolders = new LinkedHashSet<>(); result = FileFolderUtil.makeFolders(this.fileFolderService, nodeService, surfConfigRef, folderDetails, ContentModel.TYPE_FOLDER, behaviourFilter, new HashSet<QName>( Arrays.asList(new QName[] { ContentModel.ASPECT_AUDITABLE })), allCreatedFolders); // MNT-16371: Revoke ownership privileges for surf-config folder, to tighten access for former SiteManagers. for (NodeRef nodeRef : allCreatedFolders) { ownableService.setOwner(nodeRef, adminUserName); } } else { // perform the cm:name path lookup against our config root node result = this.fileFolderService.resolveNamePath(surfConfigRef, pathElements); } } } catch (FileNotFoundException fnfErr) { // this is a valid condition - we return null to indicate failed lookup } } } return result; }
From source file:org.alfresco.web.bean.search.SearchContext.java
/** * Build the search query string based on the current search context members. * /* www . ja va 2 s . c o m*/ * @param minimum small possible textual string used for a match * this does not effect fixed values searches (e.g. boolean, int values) or date ranges * * @return prepared search query string */ public String buildQuery(int minimum) { String query; boolean validQuery = false; // the QName for the well known "name" attribute String nameAttr = Repository .escapeQName(QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, ELEMENT_NAME)); StringBuilder plBuf = new StringBuilder(500).append("("); StringBuilder mnBuf = new StringBuilder(500).append("-("); // match against content text String text = this.text.trim(); boolean appendText = mode == SEARCH_FILE_NAMES_CONTENTS || mode == SEARCH_ALL; if (text.length() != 0 && text.length() >= minimum) { if (text.indexOf(' ') == -1 && text.charAt(0) != '"') { // check for existance of a special operator boolean operatorAND = (text.charAt(0) == OP_AND); boolean operatorNOT = (text.charAt(0) == OP_NOT); // strip operator from term if one was found if (operatorAND || operatorNOT) { text = text.substring(1); } if (text.length() != 0) { if (operatorNOT) { processSearchTextAttribute(nameAttr, text, appendText, mnBuf); processSearchAdditionalAttributes(text, mnBuf, this.simpleSearchAdditionalAttrs); } else { if (plBuf.length() > 1) { plBuf.append(' '); } if (operatorAND) { plBuf.append(OP_AND); } plBuf.append('('); processSearchTextAttribute(nameAttr, text, appendText, plBuf); processSearchAdditionalAttributes(text, plBuf, this.simpleSearchAdditionalAttrs); plBuf.append(')'); } } } else { // multiple word search if (text.charAt(0) == '"' && text.charAt(text.length() - 1) == '"') { // as a single quoted phrase String quotedSafeText = '"' + SearchLanguageConversion.escapeLuceneQuery(text.substring(1, text.length() - 1)) + '"'; if (appendText) { plBuf.append("TEXT:").append(quotedSafeText); } plBuf.append(" @").append(nameAttr).append(":").append(quotedSafeText); for (QName qname : this.simpleSearchAdditionalAttrs) { plBuf.append(" @").append(Repository.escapeQName(qname)).append(":").append(quotedSafeText); } } else { // as individual search terms StringTokenizer t = new StringTokenizer(text, " "); int tokenCount = t.countTokens(); for (int i = 0; i < tokenCount; i++) { String term = t.nextToken(); // check for existance of a special operator boolean operatorAND = (term.charAt(0) == OP_AND); boolean operatorNOT = (term.charAt(0) == OP_NOT); // strip operator from term if one was found if (operatorAND || operatorNOT) { term = term.substring(1); } // special case for AND all terms if set (apply after operator character removed) // note that we can't force AND if NOT operator has been set if (operatorNOT == false) { operatorAND = operatorAND | this.forceAndTerms; } if (term.length() != 0) { if (operatorNOT) { processSearchTextAttribute(nameAttr, term, appendText, mnBuf); if (mode == SearchContext.SEARCH_ALL) { processSearchAdditionalAttributes(term, mnBuf, this.simpleSearchAdditionalAttrs); } } else { if (plBuf.length() > 0) { plBuf.append(' '); } if (operatorAND) { plBuf.append(OP_AND); } plBuf.append('('); processSearchTextAttribute(nameAttr, term, appendText, plBuf); if (mode == SearchContext.SEARCH_ALL) { processSearchAdditionalAttributes(term, plBuf, this.simpleSearchAdditionalAttrs); } plBuf.append(')'); } } } } } plBuf.append(')'); mnBuf.append(')'); validQuery = true; } // match a specific PATH for space location or categories StringBuilder pathQuery = null; if (location != null || (categories != null && categories.length != 0)) { pathQuery = new StringBuilder(128); if (location != null) { pathQuery.append(" PATH:\"").append(location).append("\" "); if (categories != null && categories.length != 0) { pathQuery.append("AND ("); } } if (categories != null && categories.length != 0) { for (int i = 0; i < categories.length; i++) { pathQuery.append(" PATH:\"").append(categories[i]).append("\" "); } if (location != null) { pathQuery.append(") "); } } } // match any extra query attribute values specified StringBuilder attributeQuery = null; if (queryAttributes.size() != 0) { attributeQuery = new StringBuilder(queryAttributes.size() << 6); for (QName qname : queryAttributes.keySet()) { String value = queryAttributes.get(qname).trim(); if (value.length() >= minimum) { processSearchAttribute(qname, value, attributeQuery); } } // handle the case where we did not add any attributes due to minimum length restrictions if (attributeQuery.length() == 0) { attributeQuery = null; } } // match any extra fixed value attributes specified if (queryFixedValues.size() != 0) { if (attributeQuery == null) { attributeQuery = new StringBuilder(queryFixedValues.size() << 6); } for (QName qname : queryFixedValues.keySet()) { String escapedName = Repository.escapeQName(qname); String value = queryFixedValues.get(qname); attributeQuery.append(" +@").append(escapedName).append(":\"") .append(SearchLanguageConversion.escapeLuceneQuery(value)).append('"'); } } // range attributes are a special case also if (rangeAttributes.size() != 0) { if (attributeQuery == null) { attributeQuery = new StringBuilder(rangeAttributes.size() << 6); } for (QName qname : rangeAttributes.keySet()) { String escapedName = Repository.escapeQName(qname); RangeProperties rp = rangeAttributes.get(qname); String value1 = SearchLanguageConversion.escapeLuceneQuery(rp.lower); String value2 = SearchLanguageConversion.escapeLuceneQuery(rp.upper); attributeQuery.append(" +@").append(escapedName).append(":").append(rp.inclusive ? "[" : "{") .append(value1).append(" TO ").append(value2).append(rp.inclusive ? "]" : "}"); } } // mimetype is a special case - it is indexed as a special attribute it comes from the combined // ContentData attribute of cm:content - ContentData string cannot be searched directly if (mimeType != null && mimeType.length() != 0) { if (attributeQuery == null) { attributeQuery = new StringBuilder(64); } String escapedName = Repository.escapeQName(QName.createQName(ContentModel.PROP_CONTENT + ".mimetype")); attributeQuery.append(" +@").append(escapedName).append(":").append(mimeType); } // match against appropriate content type String fileTypeQuery; if (contentType != null) { fileTypeQuery = " TYPE:\"" + contentType + "\" "; } else { // default to cm:content fileTypeQuery = " TYPE:\"{" + NamespaceService.CONTENT_MODEL_1_0_URI + "}content\" "; } // match against appropriate folder type String folderTypeQuery; if (folderType != null) { folderTypeQuery = " TYPE:\"" + folderType + "\" "; } else { folderTypeQuery = " TYPE:\"{" + NamespaceService.CONTENT_MODEL_1_0_URI + "}folder\" "; } if (text.length() != 0 && text.length() >= minimum) { StringBuilder buf = new StringBuilder(128); if (plBuf.length() > 2) { buf.append(plBuf); if (mnBuf.length() > 3) { buf.append(" AND "); } } if (mnBuf.length() > 3) { buf.append(mnBuf); } // text query for name and/or full text specified switch (mode) { case SearchContext.SEARCH_ALL: query = '(' + fileTypeQuery + " AND " + '(' + buf + ')' + ')' + ' ' + '(' + folderTypeQuery + " AND " + '(' + buf + "))"; break; case SearchContext.SEARCH_FILE_NAMES: case SearchContext.SEARCH_FILE_NAMES_CONTENTS: query = fileTypeQuery + " AND " + '(' + buf + ')'; break; case SearchContext.SEARCH_SPACE_NAMES: query = folderTypeQuery + " AND " + buf; break; default: throw new IllegalStateException("Unknown search mode specified: " + mode); } } else { // no text query specified - must be an attribute/value query only switch (mode) { case SearchContext.SEARCH_ALL: query = '(' + fileTypeQuery + ' ' + folderTypeQuery + ')'; break; case SearchContext.SEARCH_FILE_NAMES: case SearchContext.SEARCH_FILE_NAMES_CONTENTS: query = fileTypeQuery; break; case SearchContext.SEARCH_SPACE_NAMES: query = folderTypeQuery; break; default: throw new IllegalStateException("Unknown search mode specified: " + mode); } } // match entire query against any additional attributes specified if (attributeQuery != null) { query = attributeQuery + " AND (" + query + ')'; } // match entire query against any specified paths if (pathQuery != null) { query = "(" + pathQuery + ") AND (" + query + ')'; } query = "(" + query + ") AND NOT ASPECT:\"sys:hidden\" "; // check that we have a query worth executing - if we have no attributes, paths or text/name search // then we'll only have a search against files/type TYPE which does nothing by itself! validQuery = validQuery | (attributeQuery != null) | (pathQuery != null); if (validQuery == false) { query = null; } if (logger.isDebugEnabled()) logger.debug("Query:\r\n" + query); return query; }