Merged DEV/SWIFT to HEAD

26373: WIP: ALF-7339: RSOLR 009: Index track and build from SOLR
          - track content, track dates, basic sorting
   26388: WIP: ALF-7339: RSOLR 009: Index track and build from SOLR
          - basic tracking of d:text and d:mltext (not dual tokenisation and identifier support)
   26527: WIP ALF-7339: RSOLR 009: Index track and build from SOLR
          - track d:content, d:mltext, d:text
          - start of cross locale search and ordering support int the index (not at query time yet)
          - no dual tokenisation support yet - currently adding all fields for tokenized BOTH
          - .sort needs additional tokenisation support to use a different separator (\u0000 used to indicate locale and split stuff - better toe use {en}woof style with \u0000 split
   26822: ALF-8166: RINF 10: treenode.get.js - tweak to use "childFileFolders"
   26825: ALF-8133: RINF 10: ScriptNode - update "childByNamePath" to use optimised NodeService.getChildByName
   26850: ALF-8133: RINF 10: ScriptNode - update "childByNamePath" to use optimised NodeService.getChildByName
          - follow-on to r26825
   26862: ALF-8110: RINF 10: doclist.get.js - update "path" filter to use DB-based queries (by default)
          - milestone check-in for review and comparison (note: sorting will be pushed down as part of paging support in lower layers)
   26872: Updated SOLR dev env
   26915: ALF-8224: part 1: encapsulate cmis dictionary for SOLR usage
   27017: Javadoc: removed uncommented param
   27018: Added 'namePattern' property to NamedObjectRegistry to enforce naming conventions where required
   27019: CannedQuery interface and related infrastructure
           - Provides basic support for query, sort, filter and page
           - CannedQueryFactory allows more complex implementations where required
           - Should be enough of a starter for tasks requiring miscellaneous queries
           - ALF-7167: Canned queries
   27037: WCM QS Needs the Web-Client, so define the dependency to Eclipse
   27041: Move WCM-QS test setup to a common base class
   27044: Start to conver the WCM QS behaviour from JS to Java
   27080: Added comment section for NodeLocator script declarations
   27081: General cleanup: Removed non-javadocs, empty javadocs, unused code, etc
   27104: Fixed ALF-7476: Typo in output from MMT
   27114: ALF-7479: RSOLR 016: Query Handler
          ALF-7480: RSOLR 017: SOLR result set
          ALF-7481: RSOLR 018: Execute query against SOLR
          - First working stack

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28286 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2011-06-08 15:38:14 +00:00
parent 54faa21f3e
commit ed487863f7
8 changed files with 161 additions and 42 deletions

View File

@@ -1,8 +1,7 @@
<webscript>
<shortname>Get node property content as text</shortname>
<description>Get the content for the node property as text.</description>
<url>/api/solr/textContent/{nodeId}</url>
<url>/api/solr/textContent/{nodeId}/{propertyQName}</url>
<url>/api/solr/textContent?nodeId={nodeId}&amp;propertyQName={propertyQName?}</url>
<format default="json">argument</format>
<authentication>admin</authentication>
<transaction allow="readonly">required</transaction>

View File

@@ -28,6 +28,45 @@ function getDoclist()
}),
query = filterParams.query;
var useDB = true;
if ((useDB == true) && ((filter == "path") || (filter == "") || (filter == null)))
{
// TODO also add DB filter by "node" (in addition to "path")
var parentNode = parsedArgs.pathNode;
if (parentNode !== null)
{
var ignoreTypes=["cm:thumbnail", "fm:forums","fm:forum","fm:topic","fm:post"];
allNodes = parentNode.childFileFolders(true, true, ignoreTypes);
// TODO push down sorting to FileFolderService.list (see also AlfrescoCmisService.getChildren)
if ((args.sortField == null) || (args.sortField == "cm:name"))
{
sortByName(allNodes, args.sortAsc);
}
else if (args.sortField == "cm:content.size")
{
sortBySize(allNodes, args.sortAsc);
}
else if (args.sortField == "cm:content.mimetype")
{
sortByMimetype(allNodes, args.sortAsc);
}
else if ((args.sortField == "cm:created") || (args.sortField == "cm:modified"))
{
sortByPropDate(allNodes, args.sortAsc, args.sortField);
}
else
{
// assume string (=> supports toLowerCase)
sortByPropStr(allNodes, args.sortAsc, args.sortField);
}
}
}
else
{
// Query the nodes - passing in sort and result limit parameters
if (query !== "")
{
@@ -44,6 +83,8 @@ function getDoclist()
namespace: (filterParams.namespace ? filterParams.namespace : null)
});
}
}
// Ensure folders and folderlinks appear at the top of the list
var folderNodes = [],
@@ -216,6 +257,89 @@ function getDoclist()
});
}
// TEMP
function sortByName(arr, sortAsc)
{
arr.sort
(
function( a, b )
{
return ((sortAsc == null) || (sortAsc == "true"))
? (b.name.toLowerCase() > a.name.toLowerCase() ? -1 : 1)
: (a.name.toLowerCase() > b.name.toLowerCase() ? -1 : 1);
}
);
}
// TEMP
function sortBySize(arr, sortAsc)
{
arr.sort
(
function( a, b )
{
return ((sortAsc == null) || (sortAsc == "true"))
? (b.size > a.size ? -1 : 1)
: (a.size > b.size ? -1 : 1);
}
);
}
// TEMP
function sortByMimetype(arr, sortAsc)
{
arr.sort
(
function( a, b )
{
return ((sortAsc == null) || (sortAsc == "true"))
? (b.mimetype.toLowerCase() > a.mimetype.toLowerCase() ? -1 : 1)
: (a.mimetype.toLowerCase() > b.mimetype.toLowerCase() ? -1 : 1);
}
);
}
// TEMP
function sortByPropStr(arr, sortAsc, sortField)
{
arr.sort
(
function( a, b )
{
var aStr = a.properties[sortField];
if (aStr == null)
{
aStr = "";
}
var bStr = b.properties[sortField];
if (bStr == null)
{
bStr = "";
}
return ((sortAsc == null) || (sortAsc == "true"))
? (bStr == "" && aStr != "" ? -1 : (bStr != "" && aStr == "" ? 1 : (bStr.toLowerCase() > aStr.toLowerCase() ? -1 : 1)))
: (aStr == "" && bStr != "" ? -1 : (aStr != "" && bStr == "" ? 1 : (aStr.toLowerCase() > bStr.toLowerCase() ? -1 : 1)));
}
);
}
// TEMP
function sortByPropDate(arr, sortAsc, sortField)
{
arr.sort
(
function( a, b )
{
return ((sortAsc == null) || (sortAsc == "true"))
? (b.properties[sortField] - a.properties[sortField])
: (a.properties[sortField] - b.properties[sortField]);
}
);
}
/**
* Document List Component: doclist
*/

View File

@@ -12,12 +12,7 @@ function getTreeNode()
{
var items = new Array(),
hasSubfolders = true,
ignoredTypes =
{
"{http://www.alfresco.org/model/forum/1.0}forum": true,
"{http://www.alfresco.org/model/forum/1.0}topic": true,
"{http://www.alfresco.org/model/content/1.0}systemfolder": true
},
ignoredTypes = ['fm:forum','fm:topic'],
evalChildFolders = args["children"] !== "false",
resultsTrimmed = false,
argMax = parseInt(args["max"], 10),
@@ -31,9 +26,8 @@ function getTreeNode()
}
// Look for folders in the pathNode
for each (item in parsedArgs.pathNode.children)
{
if (item.isSubType("cm:folder") && !(item.type in ignoredTypes))
var folders = parsedArgs.pathNode.childFileFolders(false, true, ignoredTypes);
for each (item in folders)
{
if (evalChildFolders)
{
@@ -45,7 +39,6 @@ function getTreeNode()
node: item,
hasSubfolders: hasSubfolders
});
}
if (maxItems !== -1 && items.length > maxItems)
{

View File

@@ -1254,6 +1254,10 @@
<property name="nodeDAO" ref="nodeDAO"/>
</bean>
<!-- -->
<!-- Node Locator -->
<!-- -->
<!-- -->
<bean id="webscript.org.alfresco.repository.nodelocator.node-location.get"
class="org.alfresco.repo.web.scripts.nodelocator.NodeLocationGet"

View File

@@ -20,8 +20,8 @@ package org.alfresco.repo.cmis.rest;
import java.util.List;
import org.alfresco.cmis.CMISAccessControlFormatEnum;
import org.alfresco.cmis.CMISAccessControlService;
import org.alfresco.opencmis.CMISAccessControlFormatEnum;
import org.alfresco.repo.template.TemplateNode;
import org.alfresco.service.cmr.repository.NodeRef;

View File

@@ -33,7 +33,6 @@ import java.util.Map.Entry;
import javax.xml.bind.JAXBElement;
import org.alfresco.cmis.CMISAccessControlEntry;
import org.alfresco.cmis.CMISAccessControlFormatEnum;
import org.alfresco.cmis.CMISAccessControlReport;
import org.alfresco.cmis.CMISAccessControlService;
import org.alfresco.cmis.CMISAclPropagationEnum;
@@ -54,6 +53,7 @@ import org.alfresco.cmis.PropertyFilter;
import org.alfresco.cmis.acl.CMISAccessControlEntryImpl;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.opencmis.CMISAccessControlFormatEnum;
import org.alfresco.repo.cmis.ws.utils.ExceptionUtil;
import org.alfresco.repo.cmis.ws.utils.PropertyUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil;

View File

@@ -18,9 +18,9 @@
*/
package org.alfresco.repo.cmis.ws;
import org.alfresco.cmis.CMISAccessControlFormatEnum;
import org.alfresco.cmis.CMISAccessControlReport;
import org.alfresco.cmis.CMISServiceException;
import org.alfresco.opencmis.CMISAccessControlFormatEnum;
import org.alfresco.repo.cmis.ws.utils.ExceptionUtil;
import org.alfresco.service.cmr.repository.NodeRef;

View File

@@ -93,16 +93,15 @@ public class GetNodeContent extends StreamContent
{
ContentReader textReader = null;
Exception transformException = null;
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
String nodeIDString = templateVars.get("nodeId");
String nodeIDString = req.getParameter("nodeId");
if(nodeIDString == null)
{
throw new WebScriptException("nodeID parameter is required for GetNodeContent");
}
long nodeId = Long.valueOf(nodeIDString).longValue();
String propertyQName = templateVars.get("propertyQName");
String propertyQName = req.getParameter("propertyQName");
QName propertyName = null;
if(propertyQName == null)
{