diff --git a/source/java/org/alfresco/rest/api/impl/NodesImpl.java b/source/java/org/alfresco/rest/api/impl/NodesImpl.java index 6787f6b6db..058f7cb4eb 100644 --- a/source/java/org/alfresco/rest/api/impl/NodesImpl.java +++ b/source/java/org/alfresco/rest/api/impl/NodesImpl.java @@ -146,7 +146,8 @@ public class NodesImpl implements Nodes private Set nonAttachContentTypes = Collections.EMPTY_SET; // pre-configured whitelist, eg. images & pdf - public void setNonAttachContentTypes(Set nonAttachWhiteList) { + public void setNonAttachContentTypes(Set nonAttachWhiteList) + { this.nonAttachContentTypes = nonAttachWhiteList; } @@ -172,7 +173,8 @@ public class NodesImpl implements Nodes } } - public void setServiceRegistry(ServiceRegistry sr) { + public void setServiceRegistry(ServiceRegistry sr) + { this.sr = sr; } @@ -228,7 +230,8 @@ public class NodesImpl implements Nodes private final static String PARAM_NODETYPE = "nodeType"; private final static Map MAP_PARAM_QNAME; - static { + static + { Map aMap = new HashMap<>(9); aMap.put(PARAM_ISFOLDER, GetChildrenCannedQuery.SORT_QNAME_NODE_IS_FOLDER); @@ -511,23 +514,28 @@ public class NodesImpl implements Nodes { final List pathElements = new ArrayList<>(0); - if ((path != null) && (! path.isEmpty())) { + if ((path != null) && (! path.isEmpty())) + { - if (path.startsWith("/")) { + if (path.startsWith("/")) + { path = path.substring(1); } - if (! path.isEmpty()) { + if (! path.isEmpty()) + { pathElements.addAll(Arrays.asList(path.split("/"))); if (checkForCompanyHome) { /* - if (nodeService.getRootNode(parentNodeRef.getStoreRef()).equals(parentNodeRef)) { + if (nodeService.getRootNode(parentNodeRef.getStoreRef()).equals(parentNodeRef)) + { // special case NodeRef chNodeRef = repositoryHelper.getCompanyHome(); String chName = (String)nodeService.getProperty(chNodeRef, ContentModel.PROP_NAME); - if (chName.equals(pathElements.get(0))) { + if (chName.equals(pathElements.get(0))) + { pathElements = pathElements.subList(1, pathElements.size()); parentNodeRef = chNodeRef; } @@ -538,8 +546,10 @@ public class NodesImpl implements Nodes } FileInfo fileInfo = null; - try { - if (pathElements.size() != 0) { + try + { + if (pathElements.size() != 0) + { fileInfo = fileFolderService.resolveNamePath(parentNodeRef, pathElements); } else @@ -551,7 +561,8 @@ public class NodesImpl implements Nodes } } } - catch (FileNotFoundException fnfe) { + catch (FileNotFoundException fnfe) + { // convert checked exception throw new InvalidNodeRefException(fnfe.getMessage()+" ["+path+"]", parentNodeRef); } @@ -583,7 +594,8 @@ public class NodesImpl implements Nodes private Node getFolderOrDocument(final NodeRef nodeRef, NodeRef parentNodeRef, QName nodeTypeQName, List selectParam, Map mapUserInfo) { - if (mapUserInfo == null) { + if (mapUserInfo == null) + { mapUserInfo = new HashMap<>(2); } @@ -809,7 +821,8 @@ public class NodesImpl implements Nodes Serializable value = nodeProps.get(qName); if (value != null) { - if (PROPS_USERLOOKUP.contains(qName)) { + if (PROPS_USERLOOKUP.contains(qName)) + { value = Node.lookupUserInfo((String)value, mapUserInfo, sr.getPersonService()); } props.put(qName.toPrefixString(namespaceService), value); @@ -1024,7 +1037,7 @@ public class NodesImpl implements Nodes private NodeRef createNodeImpl(NodeRef parentNodeRef, String nodeName, QName nodeTypeQName, Map props) { - if(props == null) + if (props == null) { props = new HashMap<>(1); } @@ -1169,7 +1182,8 @@ public class NodesImpl implements Nodes String name = (String)nodeProps.get(ContentModel.PROP_NAME); org.alfresco.rest.framework.resource.content.ContentInfo ci = null; - if (cd != null) { + if (cd != null) + { ci = new org.alfresco.rest.framework.resource.content.ContentInfoImpl(cd.getMimetype(), cd.getEncoding(), cd.getSize(), cd.getLocale()); } diff --git a/source/java/org/alfresco/rest/framework/resource/content/NodeBinaryResource.java b/source/java/org/alfresco/rest/framework/resource/content/NodeBinaryResource.java index d02c377234..80f8ec9d8e 100755 --- a/source/java/org/alfresco/rest/framework/resource/content/NodeBinaryResource.java +++ b/source/java/org/alfresco/rest/framework/resource/content/NodeBinaryResource.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2015 Alfresco Software Limited. + * Copyright (C) 2005-2016 Alfresco Software Limited. * * This file is part of Alfresco * @@ -54,11 +54,13 @@ public class NodeBinaryResource implements BinaryResource return this.propertyQName; } - public ContentInfo getContentInfo() { + public ContentInfo getContentInfo() + { return this.contentInfo; } - public String getAttachFileName() { + public String getAttachFileName() + { return this.attachFileName; } } diff --git a/source/java/org/alfresco/rest/framework/webscripts/ResourceWebScriptGet.java b/source/java/org/alfresco/rest/framework/webscripts/ResourceWebScriptGet.java index 5024b86e18..2d7ae88393 100644 --- a/source/java/org/alfresco/rest/framework/webscripts/ResourceWebScriptGet.java +++ b/source/java/org/alfresco/rest/framework/webscripts/ResourceWebScriptGet.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ package org.alfresco.rest.framework.webscripts; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; @@ -198,7 +216,8 @@ public class ResourceWebScriptGet extends AbstractResourceWebScript implements P if (result instanceof BinaryResource) { ContentInfo ci = null; - if (result instanceof NodeBinaryResource) { + if (result instanceof NodeBinaryResource) + { ci = ((NodeBinaryResource)result).getContentInfo(); } executionCallback.onSuccess(result, ci);