mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
43196: Merged DEV to V4.1-BUG-FIX 39849: ALF-13301: The value of bpm_reassignable is not converted by JBPM to boolean when we use timer. Flush session before closing JbpmContext. 43199: Temp fix for: ALF-16558 SOLR tracking does not do incremental updates but one single chunk 43201: Fixed ALF-11457 "Send email to user rule can't be created if the User name starts with number" 43210: Fixed ALF-16317 "Labels not displaying full text when creating a rule on a folder with IE8" 43219: Merged DEV to V4.1-BUG-FIX 43213: ALF-13277: CLONE - IMAP: User home space is opened when browsing through Content Folder URL org.alfresco.repo.model.filefolder.FileFolderServiceImpl.getNamePath(NodeRef, NodeRef) method was updated with fix that return an empty list if the root node path is requested. 43226: ALF-15755: Merged DEV to V4.1-BUG-FIX (modified) 43088: If the WebDAV path of a document exceeds 255 characters, documents opened in MSOffice cannot be saved back 1. parseRequestHeaders() method was overrode in AbstractMoveOrCopyMethod class. 2. unlockNodeIfLocked() method was added In MoveMethod. 43232: Fix for ALF-16254 - 'Leave Site' behaviour for group based site membership 43236: Fix for ALF-15236 - JSF - Edit online of html files does not keep the formatting 43239: Removed tabs 43251: ALF-16419: Content uploaded through webdav in win7 adds a write lock, resulting in rules not triggering - Use LockUtils.isLockedAndReadOnly in ActionExecuterAbstractBase 43310: Fix for ALF-16469 *** Solr Indexing - Index for 5M docs, 2M txns, 2TB content, 50k users, 10k groups grows up to 300GB with FTS disabled. Is it expected? - first pass at reducing stored fields in the SOLR index - PATH and secondary parent info 43314: ALF-16575 - Email server does not accept email where Subject ends with a period 43357: ALF-16573: LDAP synchronization fails when a child group has more than one parent - Because AbstractNodeDAOImpl was wrongly recognizing a deadlock as a DuplicateChildNodeNameException - Now it correctly recognizes the PostgreSQL "40P01" SQLSTATE 43359: Merged DEV to V4.1-BUG-FIX 43338: ALF-16515: Error 403 when authenticating against an Active Directory Transaction type for login Web script has been modified to 'readwrite' to introduce a possibility creating missing people in the context of the regular '/api/login' 'LoginBean'. This is necessary for some authentication mechanisms. For example, for Kerberos authentication without SSO git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@43362 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
187 lines
6.5 KiB
Java
187 lines
6.5 KiB
Java
/*
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
*/
|
|
package org.alfresco.repo.webdav;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import org.alfresco.model.ContentModel;
|
|
import org.alfresco.service.cmr.model.FileFolderService;
|
|
import org.alfresco.service.cmr.model.FileInfo;
|
|
import org.alfresco.service.cmr.model.FileNotFoundException;
|
|
import org.alfresco.service.cmr.repository.NodeRef;
|
|
import org.alfresco.service.cmr.repository.NodeService;
|
|
|
|
/**
|
|
* Implements the WebDAV COPY and MOVE methods
|
|
*
|
|
* @author Derek Hulley
|
|
*/
|
|
public abstract class AbstractMoveOrCopyMethod extends HierarchicalMethod
|
|
{
|
|
/**
|
|
* Default constructor
|
|
*/
|
|
public AbstractMoveOrCopyMethod()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Implement the move or copy, depending on the implementation
|
|
*
|
|
* @param fileFolderService the service to do the work
|
|
* @param sourceNodeRef the node to copy or move
|
|
* @param destParentNodeRef the destination parent
|
|
* @param name the name of the file or folder
|
|
* @throws Exception
|
|
*/
|
|
protected abstract void moveOrCopy(
|
|
FileFolderService fileFolderService,
|
|
NodeRef sourceNodeRef,
|
|
NodeRef sourceParentNodeRef,
|
|
NodeRef destParentNodeRef,
|
|
String name) throws Exception;
|
|
|
|
/**
|
|
* Exceute the request
|
|
*
|
|
* @exception WebDAVServerException
|
|
*/
|
|
protected final void executeImpl() throws WebDAVServerException, Exception
|
|
{
|
|
FileFolderService fileFolderService = getFileFolderService();
|
|
|
|
NodeRef rootNodeRef = getRootNodeRef();
|
|
String servletPath = getServletPath();
|
|
|
|
// Debug
|
|
if (logger.isDebugEnabled())
|
|
{
|
|
logger.debug("Copy from " + getPath() + " to " + getDestinationPath());
|
|
}
|
|
|
|
// the source must exist
|
|
String sourcePath = getPath();
|
|
FileInfo sourceInfo = null;
|
|
try
|
|
{
|
|
sourceInfo = getDAVHelper().getNodeForPath(rootNodeRef, sourcePath, servletPath);
|
|
}
|
|
catch (FileNotFoundException e)
|
|
{
|
|
throw new WebDAVServerException(HttpServletResponse.SC_NOT_FOUND);
|
|
}
|
|
|
|
FileInfo sourceParentInfo = getDAVHelper().getParentNodeForPath(rootNodeRef, sourcePath, servletPath);
|
|
|
|
// the destination parent must exist
|
|
String destPath = getDestinationPath();
|
|
FileInfo destParentInfo = null;
|
|
try
|
|
{
|
|
if (destPath.endsWith(WebDAVHelper.PathSeperator))
|
|
{
|
|
destPath = destPath.substring(0, destPath.length() - 1);
|
|
}
|
|
destParentInfo = getDAVHelper().getParentNodeForPath(rootNodeRef, destPath, servletPath);
|
|
}
|
|
catch (FileNotFoundException e)
|
|
{
|
|
if (logger.isDebugEnabled())
|
|
{
|
|
logger.debug("Destination parent folder doesn't exist: " + destPath);
|
|
}
|
|
throw new WebDAVServerException(HttpServletResponse.SC_CONFLICT);
|
|
}
|
|
|
|
// check for the existence of the destination node
|
|
FileInfo destInfo = null;
|
|
try
|
|
{
|
|
destInfo = getDAVHelper().getNodeForPath(rootNodeRef, destPath, servletPath);
|
|
if (!destInfo.getNodeRef().equals(sourceInfo.getNodeRef()))
|
|
{
|
|
// ALF-7079 fix, if destInfo is working copy then content will be updated later
|
|
boolean isDestWorkingCopy = getNodeService().hasAspect(destInfo.getNodeRef(), ContentModel.ASPECT_WORKING_COPY);
|
|
if (!hasOverWrite() && !isDestWorkingCopy)
|
|
{
|
|
if (logger.isDebugEnabled())
|
|
{
|
|
logger.debug("Destination exists but overwrite is not allowed");
|
|
}
|
|
// it exists and we may not overwrite
|
|
throw new WebDAVServerException(HttpServletResponse.SC_PRECONDITION_FAILED);
|
|
}
|
|
// delete the destination node if it is not the same as the source node and not a working copy
|
|
if (!isDestWorkingCopy && !isShuffleOperation(sourceInfo) && !isVersioned(destInfo))
|
|
{
|
|
checkNode(destInfo);
|
|
|
|
// attempting to move or copy onto another node
|
|
fileFolderService.delete(destInfo.getNodeRef());
|
|
}
|
|
}
|
|
}
|
|
catch (FileNotFoundException e)
|
|
{
|
|
// destination doesn't exist
|
|
}
|
|
|
|
NodeRef sourceNodeRef = sourceInfo.getNodeRef();
|
|
NodeRef sourceParentNodeRef = sourceParentInfo.getNodeRef();
|
|
NodeRef destParentNodeRef = destParentInfo.getNodeRef();
|
|
|
|
String name = getDAVHelper().splitPath(destPath)[1];
|
|
|
|
moveOrCopy(fileFolderService, sourceNodeRef, sourceParentNodeRef, destParentNodeRef, name);
|
|
|
|
// Set the response status
|
|
if (destInfo == null)
|
|
{
|
|
m_response.setStatus(HttpServletResponse.SC_CREATED);
|
|
}
|
|
else
|
|
{
|
|
m_response.setStatus(HttpServletResponse.SC_NO_CONTENT);
|
|
}
|
|
}
|
|
|
|
|
|
protected boolean isVersioned(FileInfo fileInfo)
|
|
{
|
|
NodeService nodeService = getNodeService();
|
|
boolean versioned = nodeService.hasAspect(fileInfo.getNodeRef(), ContentModel.ASPECT_VERSIONABLE);
|
|
return versioned;
|
|
}
|
|
|
|
protected boolean isShuffleOperation(FileInfo sourceInfo)
|
|
{
|
|
NodeService nodeService = getNodeService();
|
|
boolean hidden = nodeService.hasAspect(sourceInfo.getNodeRef(), ContentModel.ASPECT_HIDDEN);
|
|
boolean temporary = nodeService.hasAspect(sourceInfo.getNodeRef(), ContentModel.ASPECT_TEMPORARY);
|
|
boolean shuffleOperation = hidden && temporary;
|
|
return shuffleOperation;
|
|
}
|
|
|
|
protected void parseRequestHeaders() throws WebDAVServerException
|
|
{
|
|
super.parseRequestHeaders();
|
|
parseIfHeader();
|
|
}
|
|
}
|