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

119775 jkaabimofrad: RA-635: Fixed Resource API fwk, where a resource is used to create a node via both JSON and multipart/form-data.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@126365 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamal Kaabi-Mofrad
2016-05-10 10:32:47 +00:00
parent 84f812c5c2
commit 04239107de

View File

@@ -1,3 +1,22 @@
/*
* 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.webscripts;
import java.util.Arrays;
@@ -153,7 +172,7 @@ public class ResourceWebScriptPost extends AbstractResourceWebScript implements
throw new DeletedResourceException("(DELETE) " + resource.getMetaData().getUniqueId());
}
if (resObj instanceof MultiPartResourceAction.Create<?>)
if (resObj instanceof MultiPartResourceAction.Create<?> && params.getPassedIn() instanceof FormData)
{
MultiPartResourceAction.Create<Object> creator = (MultiPartResourceAction.Create<Object>) resObj;
return creator.create((FormData) params.getPassedIn(), params);
@@ -180,7 +199,7 @@ public class ResourceWebScriptPost extends AbstractResourceWebScript implements
throw new DeletedResourceException("(DELETE) " + resource.getMetaData().getUniqueId());
}
if (resObj instanceof MultiPartRelationshipResourceAction.Create<?>)
if (resObj instanceof MultiPartRelationshipResourceAction.Create<?> && params.getPassedIn() instanceof FormData)
{
MultiPartRelationshipResourceAction.Create<Object> creator = (MultiPartRelationshipResourceAction.Create<Object>) resObj;
return creator.create(params.getEntityId(), (FormData) params.getPassedIn(), params);