/*
* Copyright (C) 2005-2010 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
* Authentication and transactions are the client's responsibility.
*
* @return Returns an existing folder reference or null
*/
public NodeRef getFolderPath(
NamespaceService namespaceService,
NodeService nodeService,
SearchService searchService,
FileFolderService fileFolderService)
{
NodeRef pathStartNodeRef = super.resolveNodePath(namespaceService, nodeService, searchService);
if (pathStartNodeRef == null)
{
throw new AlfrescoRuntimeException(
"Folder path resolution requires an existing base path. \n" +
" Base path: " + getRootPath());
}
// Just choose the root path if the folder path is empty
if (folderPath.length() == 0)
{
return pathStartNodeRef;
}
else
{
List
* Authentication and transactions are the client's responsibility.
*
* @return Returns an existing or new folder reference
*/
public NodeRef getOrCreateFolderPath(
NamespaceService namespaceService,
NodeService nodeService,
SearchService searchService,
FileFolderService fileFolderService)
{
NodeRef pathStartNodeRef = super.resolveNodePath(namespaceService, nodeService, searchService);
if (pathStartNodeRef == null)
{
throw new AlfrescoRuntimeException(
"Folder path resolution requires an existing base path. \n" +
" Base path: " + getRootPath());
}
// Just choose the root path if the folder path is empty
if (folderPath.length() == 0)
{
return pathStartNodeRef;
}
else
{
StringTokenizer folders = new StringTokenizer(folderPath, "/");
NodeRef nodeRef = pathStartNodeRef;
while (folders.hasMoreTokens())
{
QName folderQName = QName.createQName(folders.nextToken(), namespaceService);
List