mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
ALF-4194 - minor fixes
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21883 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -13,7 +13,6 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
|||||||
import org.alfresco.service.cmr.repository.ContentData;
|
import org.alfresco.service.cmr.repository.ContentData;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
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.repository.Path;
|
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
@@ -37,7 +36,7 @@ public class BulkMetadataGet extends AbstractWebScript {
|
|||||||
private ServiceRegistry services;
|
private ServiceRegistry services;
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
private DictionaryService dictionaryService;
|
private DictionaryService dictionaryService;
|
||||||
|
|
||||||
private String getMimeType(ContentData contentProperty)
|
private String getMimeType(ContentData contentProperty)
|
||||||
{
|
{
|
||||||
String mimetype = null;
|
String mimetype = null;
|
||||||
@@ -49,7 +48,7 @@ public class BulkMetadataGet extends AbstractWebScript {
|
|||||||
|
|
||||||
return mimetype;
|
return mimetype;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException
|
public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException
|
||||||
{
|
{
|
||||||
@@ -86,6 +85,7 @@ public class BulkMetadataGet extends AbstractWebScript {
|
|||||||
for(int i = 0; i < nodeRefsArray.length(); i++)
|
for(int i = 0; i < nodeRefsArray.length(); i++)
|
||||||
{
|
{
|
||||||
NodeRef nodeRef = new NodeRef(nodeRefsArray.getString(i));
|
NodeRef nodeRef = new NodeRef(nodeRefsArray.getString(i));
|
||||||
|
|
||||||
if(nodeService.exists(nodeRef))
|
if(nodeService.exists(nodeRef))
|
||||||
{
|
{
|
||||||
NodeRef parentNodeRef = null;
|
NodeRef parentNodeRef = null;
|
||||||
@@ -107,12 +107,10 @@ public class BulkMetadataGet extends AbstractWebScript {
|
|||||||
jsonOut.writeValue("shortType", shortType);
|
jsonOut.writeValue("shortType", shortType);
|
||||||
TypeDefinition typeDef = dictionaryService.getType(type);
|
TypeDefinition typeDef = dictionaryService.getType(type);
|
||||||
jsonOut.writeValue("typeTitle", typeDef.getTitle());
|
jsonOut.writeValue("typeTitle", typeDef.getTitle());
|
||||||
// TODO is this always cm:title? what if custom type?
|
|
||||||
jsonOut.writeValue("name", properties.get(ContentModel.PROP_NAME).toString());
|
jsonOut.writeValue("name", (String)properties.get(ContentModel.PROP_NAME));
|
||||||
jsonOut.writeValue("title", properties.get(ContentModel.PROP_TITLE).toString());
|
jsonOut.writeValue("title", (String)properties.get(ContentModel.PROP_TITLE));
|
||||||
jsonOut.writeValue("mimeType", getMimeType((ContentData)properties.get(ContentModel.PROP_CONTENT)));
|
jsonOut.writeValue("mimeType", getMimeType((ContentData)properties.get(ContentModel.PROP_CONTENT)));
|
||||||
Path path = nodeService.getPath(nodeRef);
|
|
||||||
jsonOut.writeValue("path", path.toString());
|
|
||||||
}
|
}
|
||||||
jsonOut.endObject();
|
jsonOut.endObject();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user