mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge remote-tracking branch 'remotes/origin/release/V2.5' into merge/RM-5308_TestForShareRecordsViaAPI
# Conflicts: # rm-automation/src/test/java/org/alfresco/dataprep/RecordsManagementService.java
This commit is contained in:
@@ -81,6 +81,7 @@ public abstract class BaseAPI
|
|||||||
protected static final String ACTIONS_API = "{0}actionQueue";
|
protected static final String ACTIONS_API = "{0}actionQueue";
|
||||||
protected static final String RM_ACTIONS_API = "{0}rma/actions/ExecutionQueue";
|
protected static final String RM_ACTIONS_API = "{0}rma/actions/ExecutionQueue";
|
||||||
protected static final String RM_SITE_ID = "rm";
|
protected static final String RM_SITE_ID = "rm";
|
||||||
|
protected static final String SHARE_ACTION_API = "{0}internal/shared/share/workspace/SpacesStore/{1}";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AlfrescoHttpClientFactory alfrescoHttpClientFactory;
|
private AlfrescoHttpClientFactory alfrescoHttpClientFactory;
|
||||||
@@ -426,6 +427,7 @@ public abstract class BaseAPI
|
|||||||
if (responseBody != null && responseBody.has(EXCEPTION_KEY))
|
if (responseBody != null && responseBody.has(EXCEPTION_KEY))
|
||||||
{
|
{
|
||||||
LOGGER.error("Request failed: " + responseBody.getString(EXCEPTION_KEY));
|
LOGGER.error("Request failed: " + responseBody.getString(EXCEPTION_KEY));
|
||||||
|
returnValues = responseBody;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -26,8 +26,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.rest.v0;
|
package org.alfresco.rest.v0;
|
||||||
|
|
||||||
|
import java.text.MessageFormat;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javafx.util.Pair;
|
||||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||||
import org.alfresco.dataprep.ContentService;
|
import org.alfresco.dataprep.ContentService;
|
||||||
import org.alfresco.rest.core.v0.BaseAPI;
|
import org.alfresco.rest.core.v0.BaseAPI;
|
||||||
@@ -53,6 +55,8 @@ public class RecordsAPI extends BaseAPI
|
|||||||
|
|
||||||
private static final String CREATE_NON_ELECTRONIC_RECORD_API = "{0}type/rma:nonElectronicDocument/formprocessor";
|
private static final String CREATE_NON_ELECTRONIC_RECORD_API = "{0}type/rma:nonElectronicDocument/formprocessor";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ContentService contentService;
|
private ContentService contentService;
|
||||||
|
|
||||||
@@ -288,4 +292,31 @@ public class RecordsAPI extends BaseAPI
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Share a document
|
||||||
|
*
|
||||||
|
* @param user the user sharing the file
|
||||||
|
* @param password the user's password
|
||||||
|
* @param nodeId the node id of the file
|
||||||
|
* @return {@link Pair}. on success will be true and the shareId.
|
||||||
|
* on failure will be false and the response status code.
|
||||||
|
*/
|
||||||
|
public Pair<Boolean, String> shareDocument(String user, String password, String nodeId) throws JSONException
|
||||||
|
{
|
||||||
|
JSONObject response = doPostRequest(user, password, null,
|
||||||
|
MessageFormat.format(SHARE_ACTION_API, "{0}", nodeId));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (response.has("sharedId"))
|
||||||
|
{
|
||||||
|
return new Pair<>(true, response.getString("sharedId"));
|
||||||
|
}
|
||||||
|
} catch (JSONException e)
|
||||||
|
{
|
||||||
|
LOGGER.info("Unable to extract response parameter", e);
|
||||||
|
}
|
||||||
|
return new Pair<>(false, String.valueOf(response.getJSONObject("status").getInt("code")));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user