mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.0 to HEAD
5146: AR-1122 5148: AR-1116 5149: RM-5 5152: AR-1167 5153: WCM-324 5154: WCM-325, WCM-301, WCM-258, WCM-25, WCM-320 5156: WCM-338 5158: AR-1164 5169: AR-1216 5177: WCM-328 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5327 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -144,6 +144,12 @@ public class ContentWebService extends AbstractWebService implements
|
|||||||
// Get the file name
|
// Get the file name
|
||||||
String filename = (String)this.nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
|
String filename = (String)this.nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
|
||||||
|
|
||||||
|
// Filename may not exist if this node isn't a cm:object
|
||||||
|
if (filename == null)
|
||||||
|
{
|
||||||
|
filename = "file.bin";
|
||||||
|
}
|
||||||
|
|
||||||
// format the URL that can be used to download the content
|
// format the URL that can be used to download the content
|
||||||
String downloadUrl = MessageFormat.format(BROWSER_URL,
|
String downloadUrl = MessageFormat.format(BROWSER_URL,
|
||||||
new Object[] { req.getScheme(), address,
|
new Object[] { req.getScheme(), address,
|
||||||
|
@@ -24,6 +24,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.webservice.repository;
|
package org.alfresco.repo.webservice.repository;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.alfresco.repo.webservice.types.ResultSetRowNode;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -97,4 +103,30 @@ public abstract class AbstractQuerySession implements QuerySession
|
|||||||
queryResult.setQuerySession(null);
|
queryResult.setQuerySession(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a result set row node object for the provided node reference
|
||||||
|
*
|
||||||
|
* @param nodeRef the node reference
|
||||||
|
* @param nodeService the node service
|
||||||
|
* @return the result set row node
|
||||||
|
*/
|
||||||
|
protected ResultSetRowNode createResultSetRowNode(NodeRef nodeRef, NodeService nodeService)
|
||||||
|
{
|
||||||
|
// Get the type
|
||||||
|
String type = nodeService.getType(nodeRef).toString();
|
||||||
|
|
||||||
|
// Get the aspects applied to the node
|
||||||
|
Set<QName> aspects = nodeService.getAspects(nodeRef);
|
||||||
|
String[] aspectNames = new String[aspects.size()];
|
||||||
|
int index = 0;
|
||||||
|
for (QName aspect : aspects)
|
||||||
|
{
|
||||||
|
aspectNames[index] = aspect.toString();
|
||||||
|
index ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create and return the result set row node
|
||||||
|
return new ResultSetRowNode(nodeRef.getId(), type, aspectNames);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -133,9 +133,7 @@ public class AssociatedQuerySession extends AbstractQuerySession
|
|||||||
{
|
{
|
||||||
AssociationRef assoc = assocs.get(x);
|
AssociationRef assoc = assocs.get(x);
|
||||||
NodeRef childNodeRef = assoc.getTargetRef();
|
NodeRef childNodeRef = assoc.getTargetRef();
|
||||||
ResultSetRowNode rowNode = new ResultSetRowNode(childNodeRef
|
ResultSetRowNode rowNode = createResultSetRowNode(childNodeRef, nodeService);
|
||||||
.getId(), nodeService.getType(childNodeRef).toString(),
|
|
||||||
null);
|
|
||||||
|
|
||||||
// create columns for all the properties of the node
|
// create columns for all the properties of the node
|
||||||
// get the data for the row and build up the columns structure
|
// get the data for the row and build up the columns structure
|
||||||
|
@@ -100,7 +100,7 @@ public class ChildrenQuerySession extends AbstractQuerySession
|
|||||||
{
|
{
|
||||||
ChildAssociationRef assoc = kids.get(x);
|
ChildAssociationRef assoc = kids.get(x);
|
||||||
NodeRef childNodeRef = assoc.getChildRef();
|
NodeRef childNodeRef = assoc.getChildRef();
|
||||||
ResultSetRowNode rowNode = new ResultSetRowNode(childNodeRef.getId(), nodeService.getType(childNodeRef).toString(), null);
|
ResultSetRowNode rowNode = createResultSetRowNode(childNodeRef, nodeService);
|
||||||
|
|
||||||
// create columns for all the properties of the node
|
// create columns for all the properties of the node
|
||||||
// get the data for the row and build up the columns structure
|
// get the data for the row and build up the columns structure
|
||||||
|
@@ -100,7 +100,7 @@ public class ParentsQuerySession extends AbstractQuerySession
|
|||||||
{
|
{
|
||||||
ChildAssociationRef assoc = parents.get(x);
|
ChildAssociationRef assoc = parents.get(x);
|
||||||
NodeRef parentNodeRef = assoc.getParentRef();
|
NodeRef parentNodeRef = assoc.getParentRef();
|
||||||
ResultSetRowNode rowNode = new ResultSetRowNode(parentNodeRef.getId(), nodeService.getType(parentNodeRef).toString(), null);
|
ResultSetRowNode rowNode = createResultSetRowNode(parentNodeRef, nodeService);
|
||||||
|
|
||||||
// create columns for all the properties of the node
|
// create columns for all the properties of the node
|
||||||
// get the data for the row and build up the columns structure
|
// get the data for the row and build up the columns structure
|
||||||
|
@@ -116,7 +116,7 @@ public class ResultSetQuerySession extends AbstractQuerySession
|
|||||||
{
|
{
|
||||||
ResultSetRow origRow = searchResults.getRow(x);
|
ResultSetRow origRow = searchResults.getRow(x);
|
||||||
NodeRef nodeRef = origRow.getNodeRef();
|
NodeRef nodeRef = origRow.getNodeRef();
|
||||||
ResultSetRowNode rowNode = new ResultSetRowNode(nodeRef.getId(), nodeService.getType(nodeRef).toString(), null);
|
ResultSetRowNode rowNode = createResultSetRowNode(nodeRef, nodeService);
|
||||||
|
|
||||||
// get the data for the row and build up the columns structure
|
// get the data for the row and build up the columns structure
|
||||||
Map<Path, Serializable> values = origRow.getValues();
|
Map<Path, Serializable> values = origRow.getValues();
|
||||||
@@ -131,7 +131,7 @@ public class ResultSetQuerySession extends AbstractQuerySession
|
|||||||
attributeName = attributeName.substring(1);
|
attributeName = attributeName.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
columns[col] = Utils.createNamedValue(dictionaryService, QName.createQName(attributeName), values.get(path)); //new NamedValue(attributeName, value);
|
columns[col] = Utils.createNamedValue(dictionaryService, QName.createQName(attributeName), values.get(path));
|
||||||
col++;
|
col++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user