Merged V2.1 to HEAD

6833: Kerberos web filter for the web client.
   6834: Kerberos web filter for WebDAV
   6835: Updates to CIFS Kerberos logon support.
   6836: Fix issue with editing properties of AVM nodes and changed clipboard to use lock aware AVM service
   6837: Commented out the unknown opcode reporting as it can quickly fill the log files. AR-1742.
   6839: Patch to allow * and ? wildcard characters within a term in any web-client search
   6840: Fixed AR-1769: InvalidNameEndingPatch fails when running on 2.1
   6841: AR-1761.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6873 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-27 12:47:37 +00:00
parent a215c4c0a6
commit 737c4ade1e
4 changed files with 948 additions and 82 deletions

View File

@@ -518,44 +518,9 @@ public final class SearchContext implements Serializable
{
if (value.indexOf(' ') == -1)
{
String safeValue;
String prefix = "";
String suffix = "";
// look for a wildcard suffix
if (value.charAt(value.length() - 1) != OP_WILDCARD)
{
// look for wildcard prefix
if (value.charAt(0) != OP_WILDCARD)
{
safeValue = QueryParser.escape(value);
}
else
{
safeValue = QueryParser.escape(value.substring(1));
prefix = STR_OP_WILDCARD;
}
}
else
{
// found a wildcard suffix - append it again after escaping the other characters
suffix = STR_OP_WILDCARD;
// look for wildcard prefix
if (value.charAt(0) != OP_WILDCARD)
{
safeValue = QueryParser.escape(value.substring(0, value.length() - 1));
}
else
{
safeValue = QueryParser.escape(value.substring(1, value.length() - 1));
prefix = STR_OP_WILDCARD;
}
}
if (andOp) buf.append('+');
buf.append('@').append(Repository.escapeQName(qname)).append(":")
.append(prefix).append(safeValue).append(suffix).append(' ');
.append(SearchContext.escape(value)).append(' ');
}
else
{
@@ -577,44 +542,30 @@ public final class SearchContext implements Serializable
*/
private static void processSearchTextAttribute(String qname, String value, StringBuilder attrBuf, StringBuilder textBuf)
{
String safeValue;
String suffix = "";
String prefix = "";
if (value.charAt(value.length() - 1) != OP_WILDCARD)
{
// look for wildcard prefix
if (value.charAt(0) != OP_WILDCARD)
{
safeValue = QueryParser.escape(value);
}
else
{
// found a leading wildcard - prepend it again after escaping the other characters
prefix = STR_OP_WILDCARD;
safeValue = QueryParser.escape(value.substring(1));
}
}
else
{
suffix = STR_OP_WILDCARD;
// look for wildcard prefix
if (value.charAt(0) != OP_WILDCARD)
{
safeValue = QueryParser.escape(value.substring(0, value.length() - 1));
}
else
{
if (value.length() == 1) return; // handle just opcode
prefix = STR_OP_WILDCARD;
safeValue = QueryParser.escape(value.substring(1, value.length() - 1));
}
}
textBuf.append("TEXT:").append(prefix).append(safeValue).append(suffix);
textBuf.append("TEXT:").append(SearchContext.escape(value));
attrBuf.append("@").append(qname).append(":")
.append(prefix).append(safeValue).append(suffix);
.append(SearchContext.escape(value));
}
/**
* Returns a String where those characters that QueryParser
* expects to be escaped are escaped by a preceding <code>\</code>.
* '*' and '?' are not escaped.
*/
private static String escape(String s)
{
StringBuffer sb = new StringBuffer(s.length() + 4);
for (int i = 0; i < s.length(); i++)
{
char c = s.charAt(i);
if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')' || c == ':' ||
c == '^' || c == '[' || c == ']' || c == '\"' || c == '{' || c == '}' || c == '~')
{
sb.append('\\');
}
sb.append(c);
}
return sb.toString();
}
/**