mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-30 18:15:39 +00:00
47256: Merged DEV to V4.1-BUG-FIX 47145: ALF-17877 : CLONE - The deleted via Sharepoint document is not removed from Alfresco but hidden aspect is added for it Setting webdav client for all webdav requests in SPP module. 47257: ALF-17816 (Incorrect tooltip 'Locked by' icon for other user) 47285: ALF-17635: Incorrect behavior of Move action in Update rule and Outbound rule in Share - Altered MoveActionExcecuter so that it doesn't fire on a working copy and will hence wait for checkin 47287: Fixes ALF-2590: Calendar doesn't handle 401 errors properly: - callUtils now pass on non 200 status codes (rather than swallowing errors) - updates create-event template to handle missing data. 47288: ALF-17057: SPP: Extra version is created when add new document via Document Connection on MacOS X Lion - Now we ignore empty content when we create the initial version 47290: ALF-16931: Bootstrapped users with Uppercase name cannot see site they have been invited to - Changed the code to be conditional on association type 47296: ALF-4565: Incorrect behaviour of Edit Online action if document's name contains wildcards - URLs were incorrectly being double decoded in DefaultAuthenticationHandler 47308: Merged DEV to V4.1-BUG-FIX 47298: ALF-17907 : specified index does not exist during upgrade to 4.1.2 The droppping of alf_node.store_id index was marked as optional to support the upgrades from originally Alfresco 2.2 for Oracle DB. 47314: Fixed ALF-13679 "Cannot play a movie file in Preview, which has double byte characters in the file name" 47322: ALL LANGS: Translation updates based on EN r47138 47325: ALL LANGS: Translation updates based on EN r47138 47327: Removes unused TinyMCE files (as part of ALF-17451 ) 47329: FR, IT, NL: Fixes ALF-17413 47331: Implements fix suggested in ALF-17451, updates fixes for ALF-8486, ALF-10690 and ALF-11000. 47334: ALF-16991: Editing Rich Text files in TinyMCE loses some formatting. 47340: Merged DEV to V4.1-BUG-FIX 47306: ALF-17907 : specified index does not exist during upgrade to 4.1.2 The droppping of alf_node.store_id index was marked as optional to support the upgrades from originally Alfresco 2.2 for MS SQL Server. 47353: Merged V4.1-BUG-FIX-2012_11_26 to V4.1-BUG-FIX 44182: ALF-15970: OpenOffice form not found Show error message if form definition could not be found 47383: ALF-17222: "Protected attribute not take into account for target of associations" 47392: Merged BRANCHES/DEV/BELARUS/V4.1-BUG-FIX-2013_02_26 to BRANCHES/DEV/V4.1-BUG-FIX: 47313: ALF-18006 : Sending a PUT request without a Content-Type header resets the contents mimetype to application/octet-stream 47402: ALF-18212: SOLR OOTB cache sizes are too big and require >20GB heap space - Reduced default cache sizes from 512 to 64 47405: Fixes: ALF-14412 - Tag filtering in blogs 47407: Fix failing unit tests - use public services where transactions are required 47410: Merged V3.4-BUG-FIX to V4.1-BUG-FIX 47293: (RECORD ONLY) Merged DEV to V3.4-BUG-FIX 43417: ALF-14710 JUnit test for WebServiceSuiteSystemTest project fails - testPropertySetGet() method was updated in RepositoryServiceSystemTest class 47311: ALF-18213 / ALF-18005: webscript guestDownload does not set Content-Dispositon HTTP header - Follow on from ALF-9817 - Now it does it properly 47414: Merged V3.4-BUG-FIX to V4.1-BUG-FIX (RECORD ONLY) 47332: ALF-17640: Merged V4.1-BUG-FIX to V3.4-BUG-FIX 45828: Additional fix for ALF-17153 FTS query parser FTSQueryParser is not debuggable 47385: ALF-17935: Merged PATCHES/V4.0.2 to V3.4-BUG-FIX 42969: Merged DEV to PATCHES/V4.0.2 42967: MNT-158: SharePoint Protocol Opening Documents in Read-Only for Site Consumer with Collaborator Privileges Remove manual throwing of AccessDeniedException is user has "consumer" or "contributor" role. Create "links" container from system user. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@47419 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
159 lines
5.7 KiB
Java
159 lines
5.7 KiB
Java
/*
|
|
* Copyright (C) 2005-2013 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.opencmis;
|
|
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
import org.alfresco.error.AlfrescoRuntimeException;
|
|
import org.alfresco.repo.content.filestore.FileContentReader;
|
|
import org.alfresco.service.cmr.repository.MimetypeService;
|
|
import org.alfresco.util.TempFileProvider;
|
|
import org.aopalliance.intercept.MethodInterceptor;
|
|
import org.aopalliance.intercept.MethodInvocation;
|
|
import org.apache.chemistry.opencmis.commons.data.ContentStream;
|
|
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
|
|
|
|
/**
|
|
* Interceptor to replace ContentStream parameter values with ReusableContentStream parameters
|
|
* which unlike the original may be closed and then opened again. This is important as retrying
|
|
* transaction advice is also added. A reopen of the original results is zero bytes being read.
|
|
*
|
|
* @author Alan Davis
|
|
* @since 4.0.2.26 / 4.1.4
|
|
*/
|
|
public class AlfrescoCmisStreamInterceptor implements MethodInterceptor
|
|
{
|
|
private MimetypeService mimetypeService;
|
|
|
|
/**
|
|
* @param mimetypeService service for helping with mimetypes
|
|
*/
|
|
public void setMimetypeService(MimetypeService mimetypeService)
|
|
{
|
|
this.mimetypeService = mimetypeService;
|
|
}
|
|
|
|
public Object invoke(MethodInvocation mi) throws Throwable
|
|
{
|
|
List<ReusableContentStream> reusableContentStreams = null;
|
|
try
|
|
{
|
|
Class<?>[] parameterTypes = mi.getMethod().getParameterTypes();
|
|
Object[] arguments = mi.getArguments();
|
|
for (int i=0; i<parameterTypes.length; i++)
|
|
{
|
|
if (ContentStream.class.isAssignableFrom(parameterTypes[i]))
|
|
{
|
|
ContentStream contentStream = (ContentStream) arguments[i];
|
|
if (contentStream != null)
|
|
{
|
|
if (reusableContentStreams == null)
|
|
{
|
|
reusableContentStreams = new ArrayList<ReusableContentStream>();
|
|
}
|
|
ReusableContentStream reuableContentStream = new ReusableContentStream(contentStream);
|
|
|
|
// ALF-18006
|
|
// if (contentStream.getMimeType() == null)
|
|
// {
|
|
// String mimeType = mimetypeService.guessMimetype(reuableContentStream.getFileName(), new FileContentReader(reuableContentStream.file));
|
|
// reuableContentStream.setMimeType(mimeType);
|
|
// }
|
|
|
|
reusableContentStreams.add(reuableContentStream);
|
|
|
|
// It is possible to just change the arguments. No need to call a setter.
|
|
// Wow, did not expect that.
|
|
arguments[i] = reuableContentStream;
|
|
}
|
|
}
|
|
}
|
|
return mi.proceed();
|
|
}
|
|
finally
|
|
{
|
|
if (reusableContentStreams != null)
|
|
{
|
|
for (ReusableContentStream contentStream: reusableContentStreams)
|
|
{
|
|
contentStream.close();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static class ReusableContentStream extends ContentStreamImpl
|
|
{
|
|
private static final long serialVersionUID = 8992465629472248502L;
|
|
|
|
private File file;
|
|
|
|
public ReusableContentStream(ContentStream contentStream) throws Exception
|
|
{
|
|
setLength(contentStream.getBigLength());
|
|
setMimeType(contentStream.getMimeType());
|
|
setFileName(contentStream.getFileName());
|
|
file = TempFileProvider.createTempFile(contentStream.getStream(), "cmis", "contentStream");
|
|
}
|
|
|
|
@Override
|
|
public InputStream getStream() {
|
|
InputStream stream = super.getStream();
|
|
if (stream == null && file != null)
|
|
{
|
|
try
|
|
{
|
|
stream = new FileInputStream(file)
|
|
{
|
|
@Override
|
|
public void close() throws IOException
|
|
{
|
|
setStream(null);
|
|
super.close();
|
|
}
|
|
};
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
throw new AlfrescoRuntimeException("Expected to be able to reopen temporary file", e);
|
|
}
|
|
setStream(stream);
|
|
}
|
|
return stream;
|
|
}
|
|
|
|
public void close()
|
|
{
|
|
try
|
|
{
|
|
file.delete();
|
|
}
|
|
finally
|
|
{
|
|
file = null;
|
|
}
|
|
}
|
|
}
|
|
}
|