ACE-4469: Merged BRANCHES/DEV/HEAD-SFS (cherry picked) to HEAD

113520: SFS-179: Added multipart upload support into Public API framework.
   114561: SFS-179: Added tests for upload API, as well as minor fixes.
   114732: SFS-179: Changed the assert import from 3.X to 4.X.
   114734: SFS-179: Added unit tests for Public API framework multiPart support.
   114735: SFS-179: Fixed unit test failure.
- Also removed mergeinfo added in r112639

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@114736 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamal Kaabi-Mofrad
2015-10-19 23:25:59 +00:00
parent a4c853d923
commit 8855ef66f8
19 changed files with 760 additions and 92 deletions

View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2005-2015 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.resource.actions.interfaces;
import org.alfresco.rest.framework.resource.parameters.Parameters;
import org.springframework.extensions.webscripts.servlet.FormData;
/**
* @author Jamal Kaabi-Mofrad
*/
public interface MultiPartRelationshipResourceAction
{
/**
* HTTP POST - Upload file content and meta-data into repository
*/
public static interface Create<E> extends ResourceAction
{
public E create(String entityResourceId, FormData formData, Parameters parameters);
}
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2005-2015 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.resource.actions.interfaces;
import org.alfresco.rest.framework.resource.parameters.Parameters;
import org.springframework.extensions.webscripts.servlet.FormData;
/**
* @author Jamal Kaabi-Mofrad
*/
public interface MultiPartResourceAction
{
/**
* HTTP POST - Upload file content and meta-data into repository
*/
public static interface Create<E> extends ResourceAction
{
public E create(FormData formData, Parameters parameters);
}
}

View File

@@ -7,6 +7,7 @@ import org.alfresco.rest.framework.jacksonextensions.BeanPropertiesFilter;
import org.alfresco.rest.framework.resource.content.BasicContentInfo;
import org.alfresco.rest.framework.resource.parameters.where.Query;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.extensions.webscripts.Status;
/**
@@ -90,5 +91,12 @@ public interface Parameters
* Gets the basic information about content, typically taken from a HTTPServletRequest.
* @return BasicContentInfo the content info
*/
BasicContentInfo getContentInfo();
BasicContentInfo getContentInfo();
/**
* Gets Web Script status
*
* @return {@link Status}
*/
public Status getStatus();
}

View File

@@ -14,6 +14,7 @@ import org.alfresco.rest.framework.resource.parameters.where.Query;
import org.alfresco.rest.framework.resource.parameters.where.QueryImpl;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.extensions.webscripts.Status;
/**
* Parameters passed in from a Rest client for use in calls to the rest api.
@@ -29,7 +30,8 @@ public class Params implements Parameters
private final RecognizedParams recognizedParams;
private final String addressedProperty;
private final BasicContentInfo contentInfo;
private final Status status;
//Constants
private static final RecognizedParams NULL_PARAMS = new RecognizedParams(null, null, null, null, null, null, null);
private static final BasicContentInfo DEFAULT_CONTENT_INFO = new ContentInfoImpl(MimetypeMap.MIMETYPE_BINARY, "UTF-8", -1, null);
@@ -44,6 +46,7 @@ public class Params implements Parameters
this.recognizedParams = recognizedParams;
this.addressedProperty = addressedProperty;
this.contentInfo = contentInfo==null?DEFAULT_CONTENT_INFO:contentInfo;
this.status = new Status();
}
public static Params valueOf(BeanPropertiesFilter paramFilter, String entityId)
@@ -196,10 +199,17 @@ public class Params implements Parameters
}
@Override
public BasicContentInfo getContentInfo() {
return contentInfo;
}
public BasicContentInfo getContentInfo()
{
return contentInfo;
}
@Override
public Status getStatus()
{
return status;
}
/**
* A formal set of params that any rest service could potentially have passed in as request params
*/