mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V1.4 to HEAD
svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4133 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4145 . svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4147 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4148 . svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4151 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4152 . svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4157 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4159 . svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4161 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4162 . svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4169 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4175 . Skipped: 4146, 4151, 4153, 4156, 4157, 4160, 4163-4167 (inclusive) Last included: 4175 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4176 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -86,6 +86,7 @@ public final class SearchContext implements Serializable
|
|||||||
private static final char OP_WILDCARD = '*';
|
private static final char OP_WILDCARD = '*';
|
||||||
private static final char OP_AND = '+';
|
private static final char OP_AND = '+';
|
||||||
private static final char OP_NOT = '-';
|
private static final char OP_NOT = '-';
|
||||||
|
private static final String STR_OP_WILDCARD = "" + OP_WILDCARD;
|
||||||
|
|
||||||
/** Search mode constants */
|
/** Search mode constants */
|
||||||
public final static int SEARCH_ALL = 0;
|
public final static int SEARCH_ALL = 0;
|
||||||
@@ -174,21 +175,7 @@ public final class SearchContext implements Serializable
|
|||||||
nameAttrBuf.append(OP_NOT);
|
nameAttrBuf.append(OP_NOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// simple single word text search
|
processSearchTextAttribute(nameAttr, text, nameAttrBuf, fullTextBuf);
|
||||||
if (text.charAt(0) != OP_WILDCARD)
|
|
||||||
{
|
|
||||||
// escape characters and append the wildcard character
|
|
||||||
String safeText = QueryParser.escape(text);
|
|
||||||
fullTextBuf.append("TEXT:").append(safeText).append(OP_WILDCARD);
|
|
||||||
nameAttrBuf.append("@").append(nameAttr).append(":").append(safeText).append(OP_WILDCARD);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// found a leading wildcard - prepend it again after escaping the other characters
|
|
||||||
String safeText = QueryParser.escape(text.substring(1));
|
|
||||||
fullTextBuf.append("TEXT:*").append(safeText).append(OP_WILDCARD);
|
|
||||||
nameAttrBuf.append("@").append(nameAttr).append(":*").append(safeText).append(OP_WILDCARD);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -253,18 +240,8 @@ public final class SearchContext implements Serializable
|
|||||||
nameAttrBuf.append(OP_AND);
|
nameAttrBuf.append(OP_AND);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (term.charAt(0) != OP_WILDCARD)
|
processSearchTextAttribute(nameAttr, term, nameAttrBuf, fullTextBuf);
|
||||||
{
|
|
||||||
String safeTerm = QueryParser.escape(term);
|
|
||||||
fullTextBuf.append("TEXT:").append(safeTerm).append(OP_WILDCARD);
|
|
||||||
nameAttrBuf.append("@").append(nameAttr).append(":").append(safeTerm).append(OP_WILDCARD);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
String safeTerm = QueryParser.escape(term.substring(1));
|
|
||||||
fullTextBuf.append("TEXT:*").append(safeTerm).append(OP_WILDCARD);
|
|
||||||
nameAttrBuf.append("@").append(nameAttr).append(":*").append(safeTerm).append(OP_WILDCARD);
|
|
||||||
}
|
|
||||||
fullTextBuf.append(' ');
|
fullTextBuf.append(' ');
|
||||||
nameAttrBuf.append(' ');
|
nameAttrBuf.append(' ');
|
||||||
|
|
||||||
@@ -317,11 +294,9 @@ public final class SearchContext implements Serializable
|
|||||||
for (QName qname : queryAttributes.keySet())
|
for (QName qname : queryAttributes.keySet())
|
||||||
{
|
{
|
||||||
String value = queryAttributes.get(qname).trim();
|
String value = queryAttributes.get(qname).trim();
|
||||||
if (value.length() != 0 && value.length() >= minimum)
|
if (value.length() >= minimum)
|
||||||
{
|
{
|
||||||
String escapedName = Repository.escapeQName(qname);
|
processSearchAttribute(qname, value, attributeQuery);
|
||||||
attributeQuery.append(" +@").append(escapedName)
|
|
||||||
.append(":").append(QueryParser.escape(value)).append(OP_WILDCARD);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,6 +455,114 @@ public final class SearchContext implements Serializable
|
|||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the lucene search terms required for the specified attribute and append to a buffer.
|
||||||
|
* Supports text values with a wildcard '*' character as the prefix and/or the suffix.
|
||||||
|
*
|
||||||
|
* @param qname QName of the attribute
|
||||||
|
* @param value Non-null value of the attribute
|
||||||
|
* @param buf Buffer to append lucene terms to
|
||||||
|
*/
|
||||||
|
private static void processSearchAttribute(QName qname, String value, StringBuilder buf)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buf.append(" +@").append(Repository.escapeQName(qname)).append(":")
|
||||||
|
.append(prefix).append(safeValue).append(suffix);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// phrase multi-word search
|
||||||
|
String safeValue = QueryParser.escape(value);
|
||||||
|
buf.append(" +@").append(Repository.escapeQName(qname)).append(":\"").append(safeValue).append('"');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the lucene search terms required for the specified attribute and append to multiple buffers.
|
||||||
|
* Supports text values with a wildcard '*' character as the prefix and/or the suffix.
|
||||||
|
*
|
||||||
|
* @param qname QName.toString() of the attribute
|
||||||
|
* @param value Non-null value of the attribute
|
||||||
|
* @param attrBuf Attribute search buffer to append lucene terms to
|
||||||
|
* @param textBuf Text search buffer to append lucene terms to
|
||||||
|
*/
|
||||||
|
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
|
||||||
|
{
|
||||||
|
prefix = STR_OP_WILDCARD;
|
||||||
|
safeValue = QueryParser.escape(value.substring(1, value.length() - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
textBuf.append("TEXT:").append(prefix).append(safeValue).append(suffix);
|
||||||
|
attrBuf.append("@").append(qname).append(":")
|
||||||
|
.append(prefix).append(safeValue).append(suffix);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a search XPATH pointing to the specified node, optionally return an XPATH
|
* Generate a search XPATH pointing to the specified node, optionally return an XPATH
|
||||||
* that includes the child nodes.
|
* that includes the child nodes.
|
||||||
|
@@ -8,7 +8,6 @@ import javax.transaction.UserTransaction;
|
|||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.workflow.WorkflowModel;
|
import org.alfresco.repo.workflow.WorkflowModel;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
||||||
@@ -185,15 +184,6 @@ public class WorkflowBean
|
|||||||
node.getProperties().put("type", taskDef.metadata.getTitle());
|
node.getProperties().put("type", taskDef.metadata.getTitle());
|
||||||
node.getProperties().put("id", task.id);
|
node.getProperties().put("id", task.id);
|
||||||
|
|
||||||
// add the name of the source space (if there is one)
|
|
||||||
NodeRef context = (NodeRef)task.properties.get(WorkflowModel.PROP_CONTEXT);
|
|
||||||
if (context != null && this.nodeService.exists(context))
|
|
||||||
{
|
|
||||||
String name = Repository.getNameForNode(this.nodeService, context);
|
|
||||||
node.getProperties().put("sourceSpaceName", name);
|
|
||||||
node.getProperties().put("sourceSpaceId", context.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
// add extra properties for completed tasks
|
// add extra properties for completed tasks
|
||||||
if (task.state.equals(WorkflowTaskState.COMPLETED))
|
if (task.state.equals(WorkflowTaskState.COMPLETED))
|
||||||
{
|
{
|
||||||
|
@@ -43,52 +43,41 @@
|
|||||||
</f:facet>
|
</f:facet>
|
||||||
<h:outputText id="col3-txt" value="#{r['bpm:taskId']}" />
|
<h:outputText id="col3-txt" value="#{r['bpm:taskId']}" />
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
<%-- Source column --%>
|
|
||||||
<a:column id="col4" style="padding:2px;text-align:left">
|
|
||||||
<f:facet name="header">
|
|
||||||
<a:sortLink id="col4-sort" label="#{msg.source}" value="sourceSpaceName" styleClass="header"/>
|
|
||||||
</f:facet>
|
|
||||||
<a:actionLink id="col4-act1" value="#{r.sourceSpaceName}"
|
|
||||||
actionListener="#{BrowseBean.clickSpace}" action="browse">
|
|
||||||
<f:param name="id" value="#{r.sourceSpaceId}" />
|
|
||||||
</a:actionLink>
|
|
||||||
</a:column>
|
|
||||||
|
|
||||||
<%-- Created Date column --%>
|
<%-- Created Date column --%>
|
||||||
<a:column id="col5" style="padding:2px;text-align:left">
|
<a:column id="col4" style="padding:2px;text-align:left">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<a:sortLink id="col5-sort" label="#{msg.created}" value="created" styleClass="header"/>
|
<a:sortLink id="col4-sort" label="#{msg.created}" value="created" styleClass="header"/>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<h:outputText id="col5-txt" value="#{r.created}">
|
<h:outputText id="col4-txt" value="#{r.created}">
|
||||||
<a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" />
|
<a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" />
|
||||||
</h:outputText>
|
</h:outputText>
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
<%-- Completed date column --%>
|
<%-- Completed date column --%>
|
||||||
<a:column id="col6" style="padding:2px;text-align:left">
|
<a:column id="col5" style="padding:2px;text-align:left">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<a:sortLink id="col6-sort" label="#{msg.completed_on}" value="bpm:completionDate" styleClass="header"/>
|
<a:sortLink id="col5-sort" label="#{msg.completed_on}" value="bpm:completionDate" styleClass="header"/>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<h:outputText id="col6-txt" value="#{r['bpm:completionDate']}">
|
<h:outputText id="col5-txt" value="#{r['bpm:completionDate']}">
|
||||||
<a:convertXMLDate type="both" pattern="#{msg.date_pattern}" />
|
<a:convertXMLDate type="both" pattern="#{msg.date_pattern}" />
|
||||||
</h:outputText>
|
</h:outputText>
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
<%-- Outcome column --%>
|
<%-- Outcome column --%>
|
||||||
<a:column id="col7" style="padding:2px;text-align:left">
|
<a:column id="col6" style="padding:2px;text-align:left">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<a:sortLink id="col7-sort" label="#{msg.outcome}" value="outcome" styleClass="header"/>
|
<a:sortLink id="col6-sort" label="#{msg.outcome}" value="outcome" styleClass="header"/>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<h:outputText id="col7-txt" value="#{r.outcome}" />
|
<h:outputText id="col6-txt" value="#{r.outcome}" />
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
<%-- Actions column --%>
|
<%-- Actions column --%>
|
||||||
<a:column id="col8" actions="true" style="padding:2px;text-align:left">
|
<a:column id="col7" actions="true" style="padding:2px;text-align:left">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<h:outputText id="col8-txt" value="#{msg.actions}"/>
|
<h:outputText id="col7-txt" value="#{msg.actions}"/>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<r:actions id="col8-actions" value="dashlet_completed_actions" context="#{r}" showLink="false"
|
<r:actions id="col7-actions" value="dashlet_completed_actions" context="#{r}" showLink="false"
|
||||||
styleClass="inlineAction" />
|
styleClass="inlineAction" />
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
|
@@ -44,59 +44,48 @@
|
|||||||
<h:outputText id="col3-txt" value="#{r['bpm:taskId']}" />
|
<h:outputText id="col3-txt" value="#{r['bpm:taskId']}" />
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
<%-- Source column --%>
|
<%-- Created Date column --%>
|
||||||
<a:column id="col4" style="padding:2px;text-align:left">
|
<a:column id="col4" style="padding:2px;text-align:left">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<a:sortLink id="col4-sort" label="#{msg.source}" value="sourceSpaceName" styleClass="header"/>
|
<a:sortLink id="col4-sort" label="#{msg.created}" value="created" styleClass="header"/>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<a:actionLink id="col4-act1" value="#{r.sourceSpaceName}"
|
<h:outputText id="col4-txt" value="#{r.created}">
|
||||||
actionListener="#{BrowseBean.clickSpace}" action="browse">
|
|
||||||
<f:param name="id" value="#{r.sourceSpaceId}" />
|
|
||||||
</a:actionLink>
|
|
||||||
</a:column>
|
|
||||||
|
|
||||||
<%-- Created Date column --%>
|
|
||||||
<a:column id="col5" style="padding:2px;text-align:left">
|
|
||||||
<f:facet name="header">
|
|
||||||
<a:sortLink id="col5-sort" label="#{msg.created}" value="created" styleClass="header"/>
|
|
||||||
</f:facet>
|
|
||||||
<h:outputText id="col5-txt" value="#{r.created}">
|
|
||||||
<a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" />
|
<a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" />
|
||||||
</h:outputText>
|
</h:outputText>
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
<%-- Due date column --%>
|
<%-- Due date column --%>
|
||||||
<a:column id="col6" style="padding:2px;text-align:left">
|
<a:column id="col5" style="padding:2px;text-align:left">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<a:sortLink id="col6-sort" label="#{msg.due_date}" value="bpm:dueDate" styleClass="header"/>
|
<a:sortLink id="col5-sort" label="#{msg.due_date}" value="bpm:dueDate" styleClass="header"/>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<h:outputText id="col6-txt" value="#{r['bpm:dueDate']}">
|
<h:outputText id="col5-txt" value="#{r['bpm:dueDate']}">
|
||||||
<a:convertXMLDate type="both" pattern="#{msg.date_pattern}" />
|
<a:convertXMLDate type="both" pattern="#{msg.date_pattern}" />
|
||||||
</h:outputText>
|
</h:outputText>
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
<%-- Status column --%>
|
<%-- Status column --%>
|
||||||
<a:column id="col7" style="padding:2px;text-align:left">
|
<a:column id="col6" style="padding:2px;text-align:left">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<a:sortLink id="col7-sort" label="#{msg.status}" value="bpm:status" styleClass="header"/>
|
<a:sortLink id="col6-sort" label="#{msg.status}" value="bpm:status" styleClass="header"/>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<h:outputText id="col7-txt" value="#{r['bpm:status']}" />
|
<h:outputText id="col6-txt" value="#{r['bpm:status']}" />
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
<%-- Priority column --%>
|
<%-- Priority column --%>
|
||||||
<a:column id="col8" style="padding:2px;text-align:left">
|
<a:column id="col7" style="padding:2px;text-align:left">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<a:sortLink id="col8-sort" label="#{msg.priority}" value="bpm:priority" styleClass="header"/>
|
<a:sortLink id="col7-sort" label="#{msg.priority}" value="bpm:priority" styleClass="header"/>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<h:outputText id="col8-txt" value="#{r['bpm:priority']}" />
|
<h:outputText id="col7-txt" value="#{r['bpm:priority']}" />
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
<%-- Actions column --%>
|
<%-- Actions column --%>
|
||||||
<a:column id="col9" actions="true" style="padding:2px;text-align:left">
|
<a:column id="col8" actions="true" style="padding:2px;text-align:left">
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<h:outputText id="col9-txt" value="#{msg.actions}"/>
|
<h:outputText id="col8-txt" value="#{msg.actions}"/>
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<r:actions id="col9-actions" value="dashlet_todo_actions" context="#{r}" showLink="false"
|
<r:actions id="col8-actions" value="dashlet_todo_actions" context="#{r}" showLink="false"
|
||||||
styleClass="inlineAction" />
|
styleClass="inlineAction" />
|
||||||
</a:column>
|
</a:column>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user