Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)

120545 jvonka: FileFolder API - minor (fix formatting style - primarily opening curly brace on next line)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@126389 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamal Kaabi-Mofrad
2016-05-10 10:38:36 +00:00
parent 82fb214ab0
commit 7e62487fcb
3 changed files with 54 additions and 19 deletions

View File

@@ -146,7 +146,8 @@ public class NodesImpl implements Nodes
private Set<String> nonAttachContentTypes = Collections.EMPTY_SET; // pre-configured whitelist, eg. images & pdf private Set<String> nonAttachContentTypes = Collections.EMPTY_SET; // pre-configured whitelist, eg. images & pdf
public void setNonAttachContentTypes(Set<String> nonAttachWhiteList) { public void setNonAttachContentTypes(Set<String> nonAttachWhiteList)
{
this.nonAttachContentTypes = 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; this.sr = sr;
} }
@@ -228,7 +230,8 @@ public class NodesImpl implements Nodes
private final static String PARAM_NODETYPE = "nodeType"; private final static String PARAM_NODETYPE = "nodeType";
private final static Map<String,QName> MAP_PARAM_QNAME; private final static Map<String,QName> MAP_PARAM_QNAME;
static { static
{
Map<String,QName> aMap = new HashMap<>(9); Map<String,QName> aMap = new HashMap<>(9);
aMap.put(PARAM_ISFOLDER, GetChildrenCannedQuery.SORT_QNAME_NODE_IS_FOLDER); aMap.put(PARAM_ISFOLDER, GetChildrenCannedQuery.SORT_QNAME_NODE_IS_FOLDER);
@@ -511,23 +514,28 @@ public class NodesImpl implements Nodes
{ {
final List<String> pathElements = new ArrayList<>(0); final List<String> pathElements = new ArrayList<>(0);
if ((path != null) && (! path.isEmpty())) { if ((path != null) && (! path.isEmpty()))
{
if (path.startsWith("/")) { if (path.startsWith("/"))
{
path = path.substring(1); path = path.substring(1);
} }
if (! path.isEmpty()) { if (! path.isEmpty())
{
pathElements.addAll(Arrays.asList(path.split("/"))); pathElements.addAll(Arrays.asList(path.split("/")));
if (checkForCompanyHome) if (checkForCompanyHome)
{ {
/* /*
if (nodeService.getRootNode(parentNodeRef.getStoreRef()).equals(parentNodeRef)) { if (nodeService.getRootNode(parentNodeRef.getStoreRef()).equals(parentNodeRef))
{
// special case // special case
NodeRef chNodeRef = repositoryHelper.getCompanyHome(); NodeRef chNodeRef = repositoryHelper.getCompanyHome();
String chName = (String)nodeService.getProperty(chNodeRef, ContentModel.PROP_NAME); 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()); pathElements = pathElements.subList(1, pathElements.size());
parentNodeRef = chNodeRef; parentNodeRef = chNodeRef;
} }
@@ -538,8 +546,10 @@ public class NodesImpl implements Nodes
} }
FileInfo fileInfo = null; FileInfo fileInfo = null;
try { try
if (pathElements.size() != 0) { {
if (pathElements.size() != 0)
{
fileInfo = fileFolderService.resolveNamePath(parentNodeRef, pathElements); fileInfo = fileFolderService.resolveNamePath(parentNodeRef, pathElements);
} }
else else
@@ -551,7 +561,8 @@ public class NodesImpl implements Nodes
} }
} }
} }
catch (FileNotFoundException fnfe) { catch (FileNotFoundException fnfe)
{
// convert checked exception // convert checked exception
throw new InvalidNodeRefException(fnfe.getMessage()+" ["+path+"]", parentNodeRef); 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<String> selectParam, Map<String,UserInfo> mapUserInfo) private Node getFolderOrDocument(final NodeRef nodeRef, NodeRef parentNodeRef, QName nodeTypeQName, List<String> selectParam, Map<String,UserInfo> mapUserInfo)
{ {
if (mapUserInfo == null) { if (mapUserInfo == null)
{
mapUserInfo = new HashMap<>(2); mapUserInfo = new HashMap<>(2);
} }
@@ -809,7 +821,8 @@ public class NodesImpl implements Nodes
Serializable value = nodeProps.get(qName); Serializable value = nodeProps.get(qName);
if (value != null) if (value != null)
{ {
if (PROPS_USERLOOKUP.contains(qName)) { if (PROPS_USERLOOKUP.contains(qName))
{
value = Node.lookupUserInfo((String)value, mapUserInfo, sr.getPersonService()); value = Node.lookupUserInfo((String)value, mapUserInfo, sr.getPersonService());
} }
props.put(qName.toPrefixString(namespaceService), value); 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<QName, Serializable> props) private NodeRef createNodeImpl(NodeRef parentNodeRef, String nodeName, QName nodeTypeQName, Map<QName, Serializable> props)
{ {
if(props == null) if (props == null)
{ {
props = new HashMap<>(1); props = new HashMap<>(1);
} }
@@ -1169,7 +1182,8 @@ public class NodesImpl implements Nodes
String name = (String)nodeProps.get(ContentModel.PROP_NAME); String name = (String)nodeProps.get(ContentModel.PROP_NAME);
org.alfresco.rest.framework.resource.content.ContentInfo ci = null; 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()); ci = new org.alfresco.rest.framework.resource.content.ContentInfoImpl(cd.getMimetype(), cd.getEncoding(), cd.getSize(), cd.getLocale());
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2015 Alfresco Software Limited. * Copyright (C) 2005-2016 Alfresco Software Limited.
* *
* This file is part of Alfresco * This file is part of Alfresco
* *
@@ -54,11 +54,13 @@ public class NodeBinaryResource implements BinaryResource
return this.propertyQName; return this.propertyQName;
} }
public ContentInfo getContentInfo() { public ContentInfo getContentInfo()
{
return this.contentInfo; return this.contentInfo;
} }
public String getAttachFileName() { public String getAttachFileName()
{
return this.attachFileName; return this.attachFileName;
} }
} }

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
package org.alfresco.rest.framework.webscripts; package org.alfresco.rest.framework.webscripts;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
@@ -198,7 +216,8 @@ public class ResourceWebScriptGet extends AbstractResourceWebScript implements P
if (result instanceof BinaryResource) if (result instanceof BinaryResource)
{ {
ContentInfo ci = null; ContentInfo ci = null;
if (result instanceof NodeBinaryResource) { if (result instanceof NodeBinaryResource)
{
ci = ((NodeBinaryResource)result).getContentInfo(); ci = ((NodeBinaryResource)result).getContentInfo();
} }
executionCallback.onSuccess(result, ci); executionCallback.onSuccess(result, ci);