Merge release/V3.0 into release/V3.1.

This commit is contained in:
Tom Page
2019-08-05 15:28:53 +01:00
11 changed files with 92 additions and 73 deletions

View File

@@ -77,7 +77,7 @@ public class FilePlanAPI extends RMModelRequest
* @param filePlanId The identifier of a file plan
* @param parameters The URL parameters to add
* @return The {@link FilePlan} for the given {@code filePlanId}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>{@code filePlanId} is not a valid format</li>
* <li>authentication fails</li>
@@ -113,7 +113,7 @@ public class FilePlanAPI extends RMModelRequest
* @param filePlanId The identifier of a file plan
* @param parameters The URL parameters to add
* @return The {@link RecordCategoryCollection} for the given {@code filePlanId}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code filePlanId}</li>
@@ -177,7 +177,7 @@ public class FilePlanAPI extends RMModelRequest
/**
* see {@link #updateFilePlan(FilePlan, String, String)
*/
public FilePlan updateFilePlan(FilePlan filePlanModel, String filePlanId) throws Exception
public FilePlan updateFilePlan(FilePlan filePlanModel, String filePlanId)
{
mandatoryObject("filePlanModel", filePlanModel);
mandatoryString("filePlanId", filePlanId);
@@ -191,7 +191,7 @@ public class FilePlanAPI extends RMModelRequest
* @param filePlanModel The file plan model which holds the information
* @param filePlanId The identifier of the file plan
* @param parameters The URL parameters to add
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>the update request is invalid or {@code filePlanId} is not a valid format or {@code filePlanModel} is invalid</li>
* <li>authentication fails</li>
@@ -200,7 +200,7 @@ public class FilePlanAPI extends RMModelRequest
* <li>model integrity exception, including file name with invalid characters</li>
* </ul>
*/
public FilePlan updateFilePlan(FilePlan filePlanModel, String filePlanId, String parameters) throws Exception
public FilePlan updateFilePlan(FilePlan filePlanModel, String filePlanId, String parameters)
{
mandatoryObject("filePlanModel", filePlanModel);
mandatoryString("filePlanId", filePlanId);

View File

@@ -58,9 +58,9 @@ public class FilesAPI extends RMModelRequest<FilesAPI>
*
* @param fileId The Id of a file to declare as record
* @return The {@link Record} for created record
* @throws Exception for malformed JSON responses
* @throws RuntimeException for malformed JSON responses
*/
public Record declareAsRecord(String fileId) throws Exception
public Record declareAsRecord(String fileId)
{
mandatoryString("fileId", fileId);

View File

@@ -62,7 +62,7 @@ public class RMSiteAPI extends RMModelRequest
* Get the RM site
*
* @return The {@link RMSite} for the given file plan component id
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>Api Response code 400 Invalid parameter: GET request is supported only for the RM site</li>
* <li>Api Response code 401 If authentication failed</li>
@@ -70,7 +70,7 @@ public class RMSiteAPI extends RMModelRequest
* <li>Api Response code default Unexpected error</li>
* </ul>
*/
public RMSite getSite() throws Exception
public RMSite getSite()
{
return getRmRestWrapper().processModel(RMSite.class, simpleRequest(
GET,
@@ -83,7 +83,7 @@ public class RMSiteAPI extends RMModelRequest
*
* @param rmSite The properties of the rm site to be created
* @return The {@link RMSite} with the given properties
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>Api Response code 400 Invalid parameter: title, or description exceed the maximum length; or siteBodyCreate invalid</li>
* <li>Api Response code 401 If authentication failed</
@@ -91,7 +91,7 @@ public class RMSiteAPI extends RMModelRequest
* <li>Api Response code default Unexpected error</li>
* </ul>
*/
public RMSite createRMSite(RMSite rmSiteModel) throws Exception
public RMSite createRMSite(RMSite rmSiteModel)
{
mandatoryObject("rmSiteModel", rmSiteModel);
@@ -104,7 +104,7 @@ public class RMSiteAPI extends RMModelRequest
/**
* Delete RM site
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>Api Response code 400 Invalid parameter: DELETE request is supported only for the RM site</li>
* <li>Api Response code 401 If authentication failed</
@@ -113,7 +113,7 @@ public class RMSiteAPI extends RMModelRequest
* <li>Api Response code default Unexpected error</li>
* </ul>
*/
public void deleteRMSite() throws Exception
public void deleteRMSite()
{
getRmRestWrapper().processEmptyModel(simpleRequest(
DELETE,
@@ -126,7 +126,7 @@ public class RMSiteAPI extends RMModelRequest
*
* @param rmSiteProperties The properties to be updated
* @return The updated {@link RMSite}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>Api Response code 400 the update request is invalid {@code rmSiteModel} is invalid</li>
* <li>Api Response code 401 If authentication fails</li>
@@ -135,7 +135,7 @@ public class RMSiteAPI extends RMModelRequest
* <li>Api Response code default Unexpected error,model integrity exception</li>
* </ul>
*/
public RMSite updateRMSite(RMSite rmSiteModel) throws Exception
public RMSite updateRMSite(RMSite rmSiteModel)
{
mandatoryObject("rmSiteProperties", rmSiteModel);
@@ -150,7 +150,7 @@ public class RMSiteAPI extends RMModelRequest
* Checks if the RM site exists or not
*
* @return <code>true</code> if the RM site exists, <code>false</code> otherwise
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>Api Response code 400 Invalid parameter: GET request is supported only for the RM site</li>
* <li>Api Response code 401 If authentication failed</li>
@@ -158,7 +158,7 @@ public class RMSiteAPI extends RMModelRequest
* <li>Api Response code default Unexpected error</li>
* </ul>
*/
public boolean existsRMSite() throws Exception
public boolean existsRMSite()
{
getSite();
return getRmRestWrapper().getStatusCode().equals(OK.toString());

View File

@@ -87,6 +87,7 @@ public class RMUserAPI extends RMModelRequest
*
* @param userName User's username
* @param userRole User's RM role, one of {@link UserRoles} roles
* @throws RuntimeException for failed requests
*/
public void assignRoleToUser(String userName, String userRole)
{

View File

@@ -65,7 +65,7 @@ public class RecordCategoryAPI extends RMModelRequest
* Deletes a record category.
*
* @param recordCategoryId The identifier of a record category
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>{@code recordCategoryId} is not a valid format</li>
* <li>authentication fails</li>
@@ -101,7 +101,7 @@ public class RecordCategoryAPI extends RMModelRequest
* @param recordCategoryId The identifier of a record category
* @param parameters The URL parameters to add
* @return The {@link RecordCategory} for the given {@code recordCategoryId}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>{@code recordCategoryId} is not a valid format</li>
* <li>authentication fails</li>
@@ -124,7 +124,7 @@ public class RecordCategoryAPI extends RMModelRequest
/**
* see {@link #updateRecordCategory(RecordCategory, String, String)
*/
public RecordCategory updateRecordCategory(RecordCategory recordCategoryModel, String recordCategoryId) throws Exception
public RecordCategory updateRecordCategory(RecordCategory recordCategoryModel, String recordCategoryId)
{
mandatoryObject("recordCategoryModel", recordCategoryModel);
mandatoryString("recordCategoryId", recordCategoryId);
@@ -139,7 +139,7 @@ public class RecordCategoryAPI extends RMModelRequest
* @param recordCategoryId The identifier of a record category
* @param parameters The URL parameters to add
* @param returns The updated {@link RecordCategory}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>the update request is invalid or {@code recordCategoryId} is not a valid format or {@code recordCategoryModel} is invalid</li>
* <li>authentication fails</li>
@@ -149,7 +149,7 @@ public class RecordCategoryAPI extends RMModelRequest
* <li>model integrity exception, including file name with invalid characters</li>
* </ul>
*/
public RecordCategory updateRecordCategory(RecordCategory recordCategoryModel, String recordCategoryId, String parameters) throws Exception
public RecordCategory updateRecordCategory(RecordCategory recordCategoryModel, String recordCategoryId, String parameters)
{
mandatoryObject("recordCategoryModel", recordCategoryModel);
mandatoryString("recordCategoryId", recordCategoryId);
@@ -179,7 +179,7 @@ public class RecordCategoryAPI extends RMModelRequest
* @param recordCategoryId The identifier of a record category
* @param parameters The URL parameters to add
* @return The {@link RecordCategoryChildCollection} for the given {@code recordCategoryId}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code recordCategoryId}</li>

View File

@@ -77,7 +77,7 @@ public class RecordFolderAPI extends RMModelRequest
* Deletes a record folder.
*
* @param recordFolderId The identifier of a record folder
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>{@code recordFolderId} is not a valid format</li>
* <li>authentication fails</li>
@@ -113,7 +113,7 @@ public class RecordFolderAPI extends RMModelRequest
* @param recordFolderId The identifier of a record folder
* @param parameters The URL parameters to add
* @return The {@link RecordFolder} for the given {@code recordFolderId}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>{@code recordFolderId} is not a valid format</li>
* <li>authentication fails</li>
@@ -136,7 +136,7 @@ public class RecordFolderAPI extends RMModelRequest
/**
* see {@link #updateRecordFolder(RecordFolder, String, String)
*/
public RecordFolder updateRecordFolder(RecordFolder recordFolderModel, String recordFolderId) throws Exception
public RecordFolder updateRecordFolder(RecordFolder recordFolderModel, String recordFolderId)
{
mandatoryObject("recordFolderModel", recordFolderModel);
mandatoryString("recordFolderId", recordFolderId);
@@ -151,7 +151,7 @@ public class RecordFolderAPI extends RMModelRequest
* @param recordFolderId The identifier of a record folder
* @param parameters The URL parameters to add
* @param returns The updated {@link RecordFolder}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>the update request is invalid or {@code recordFolderId} is not a valid format or {@code recordFolderModel} is invalid</li>
* <li>authentication fails</li>
@@ -161,7 +161,7 @@ public class RecordFolderAPI extends RMModelRequest
* <li>model integrity exception, including file name with invalid characters</li>
* </ul>
*/
public RecordFolder updateRecordFolder(RecordFolder recordFolderModel, String recordFolderId, String parameters) throws Exception
public RecordFolder updateRecordFolder(RecordFolder recordFolderModel, String recordFolderId, String parameters)
{
mandatoryObject("recordFolderModel", recordFolderModel);
mandatoryString("recordFolderId", recordFolderId);
@@ -191,7 +191,7 @@ public class RecordFolderAPI extends RMModelRequest
* @param recordFolderId The identifier of a record folder
* @param parameters The URL parameters to add
* @return The {@link RecordFolderCollection} for the given {@code recordFolderId}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code recordFolderId}</li>

View File

@@ -65,7 +65,7 @@ public class RecordsAPI extends RMModelRequest
*
* @param recordId The id of the electronic record
* @return {@link ResponseBody} representing content for the given record id
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>{@code recordId} has no content</li>
* <li> {@code recordId} is not a valid format, or is not a record</li>
@@ -73,7 +73,7 @@ public class RecordsAPI extends RMModelRequest
* <li>{@code recordId} does not exist</li>
* </ul>
*/
public ResponseBody<?> getRecordContent(String recordId) throws Exception
public ResponseBody<?> getRecordContent(String recordId)
{
mandatoryString("recordId", recordId);
@@ -89,7 +89,7 @@ public class RecordsAPI extends RMModelRequest
* @param recordBodyFile The properties where to file the record
* @param recordId The id of the record to file
* @return The {@link Record} with the given properties
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>Invalid parameter: {@code recordBodyFile} is not a valid format,{@code recordId} is not a record</li>
* <li>authentication fails</li>
@@ -100,7 +100,7 @@ public class RecordsAPI extends RMModelRequest
* </ul>
*
*/
public Record fileRecord(RecordBodyFile recordBodyFile, String recordId) throws Exception
public Record fileRecord(RecordBodyFile recordBodyFile, String recordId)
{
mandatoryObject("recordBodyFile", recordBodyFile);
mandatoryString("recordId", recordId);
@@ -114,7 +114,7 @@ public class RecordsAPI extends RMModelRequest
* @param recordBodyFile The properties where to file the record
* @param recordId The id of the record to file
* @return The {@link Record} with the given properties
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>Invalid parameter: {@code recordBodyFile} is not a valid format,{@code recordId} is not a record</li>
* <li>authentication fails</li>
@@ -125,7 +125,7 @@ public class RecordsAPI extends RMModelRequest
* </ul>
*
*/
public Record fileRecord(RecordBodyFile recordBodyFile, String recordId, String parameters) throws Exception
public Record fileRecord(RecordBodyFile recordBodyFile, String recordId, String parameters)
{
mandatoryObject("requestBodyFile", recordBodyFile);
mandatoryString("recordId", recordId);
@@ -142,7 +142,7 @@ public class RecordsAPI extends RMModelRequest
/**
* see {@link #completeRecord(String, String)
*/
public Record completeRecord(String recordId) throws Exception
public Record completeRecord(String recordId)
{
mandatoryString("recordId", recordId);
@@ -154,7 +154,7 @@ public class RecordsAPI extends RMModelRequest
*
* @param recordId The id of the record to complete
* @return The completed {@link Record} with the given properties
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>Invalid parameter: {@code recordId} is not a record</li>
* <li>authentication fails</li>
@@ -164,7 +164,7 @@ public class RecordsAPI extends RMModelRequest
* <li>model integrity exception: the record has missing meta-data</li>
* </ul>
*/
public Record completeRecord(String recordId, String parameters) throws Exception
public Record completeRecord(String recordId, String parameters)
{
mandatoryString("recordId", recordId);
@@ -179,7 +179,7 @@ public class RecordsAPI extends RMModelRequest
* Deletes a record.
*
* @param recordId The identifier of a record
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>{@code recordId} is not a valid format</li>
* <li>authentication fails</li>
@@ -215,7 +215,7 @@ public class RecordsAPI extends RMModelRequest
* @param recordId The identifier of a record
* @param parameters The URL parameters to add
* @return The {@link Record} for the given {@code recordId}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>{@code recordId} is not a valid format</li>
* <li>authentication fails</li>
@@ -238,7 +238,7 @@ public class RecordsAPI extends RMModelRequest
/**
* see {@link #updateRecord(Record, String, String)
*/
public Record updateRecord(Record recordModel, String recordId) throws Exception
public Record updateRecord(Record recordModel, String recordId)
{
mandatoryObject("recordModel", recordModel);
mandatoryString("recordId", recordId);
@@ -253,7 +253,7 @@ public class RecordsAPI extends RMModelRequest
* @param recordId The identifier of a record
* @param parameters The URL parameters to add
* @return The updated {@link Record}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>the update request is invalid or {@code recordId} is not a valid format or {@code recordModel} is invalid</li>
* <li>authentication fails</li>
@@ -263,7 +263,7 @@ public class RecordsAPI extends RMModelRequest
* <li>model integrity exception, including file name with invalid characters</li>
* </ul>
*/
public Record updateRecord(Record recordModel, String recordId, String parameters) throws Exception
public Record updateRecord(Record recordModel, String recordId, String parameters)
{
mandatoryObject("recordModel", recordModel);
mandatoryString("recordId", recordId);

View File

@@ -69,7 +69,7 @@ public class TransferAPI extends RMModelRequest
* @param transferId The identifier of a transfer
* @param parameters The URL parameters to add
* @return The {@link Transfer} for the given {@code transferId}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>{@code transferId} is not a valid format</li>
* <li>authentication fails</li>
@@ -104,7 +104,7 @@ public class TransferAPI extends RMModelRequest
* @param transferId The identifier of a transfer
* @param parameters The URL parameters to add
* @return The {@link TransferChildCollection} for the given {@code transferId}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code transferId}</li>

View File

@@ -73,7 +73,7 @@ public class TransferContainerAPI extends RMModelRequest
* @param transferContainerId The identifier of a transfer container
* @param parameters The URL parameters to add
* @return The {@link TransferContainer} for the given {@code transferContainerId}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>{@code transferContainerId} is not a valid format</li>
* <li>authentication fails</li>
@@ -96,7 +96,7 @@ public class TransferContainerAPI extends RMModelRequest
/**
* see {@link #updateTransferContainer(TransferContainer, String, String)
*/
public TransferContainer updateTransferContainer(TransferContainer transferContainerModel, String transferContainerId) throws Exception
public TransferContainer updateTransferContainer(TransferContainer transferContainerModel, String transferContainerId)
{
mandatoryObject("transferContainerModel", transferContainerModel);
mandatoryString("transferContainerId", transferContainerId);
@@ -111,7 +111,7 @@ public class TransferContainerAPI extends RMModelRequest
* @param transferContainerId The identifier of a transfer container
* @param parameters The URL parameters to add
* @param returns The updated {@link TransferContainer}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>the update request is invalid or {@code transferContainerId} is not a valid format or {@code transferContainerModel} is invalid</li>
* <li>authentication fails</li>
@@ -121,7 +121,7 @@ public class TransferContainerAPI extends RMModelRequest
* <li>model integrity exception, including transfer container name with invalid characters</li>
* </ul>
*/
public TransferContainer updateTransferContainer(TransferContainer transferContainerModel, String transferContainerId, String parameters) throws Exception
public TransferContainer updateTransferContainer(TransferContainer transferContainerModel, String transferContainerId, String parameters)
{
mandatoryObject("transferContainerModel", transferContainerModel);
mandatoryString("transferContainerId", transferContainerId);
@@ -151,7 +151,7 @@ public class TransferContainerAPI extends RMModelRequest
* @param transferContainerId The identifier of a transfer container
* @param parameters The URL parameters to add
* @return The {@link TransferCollection} for the given {@code transferContainerId}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code transferContainerId}</li>

View File

@@ -39,6 +39,7 @@ import static org.springframework.http.HttpMethod.PUT;
import static org.testng.Assert.fail;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import com.fasterxml.jackson.databind.JsonNode;
@@ -86,7 +87,7 @@ public class UnfiledContainerAPI extends RMModelRequest
* @param unfiledContainerId The identifier of a unfiled record container
* @param parameters The URL parameters to add
* @return The {@link UnfiledContainer} for the given {@code unfiledContainerId}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>{@code unfiledContainerId} is not a valid format</li>
* <li>authentication fails</li>
@@ -122,7 +123,7 @@ public class UnfiledContainerAPI extends RMModelRequest
* @param unfiledContainerId The identifier of an unfiled records container
* @param parameters The URL parameters to add
* @return The {@link UnfiledContainerChildCollection} for the given {@code unfiledContainerId}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code unfiledContainerId}</li>
@@ -144,7 +145,7 @@ public class UnfiledContainerAPI extends RMModelRequest
/**
* see {@link #createUnfiledContainerChild(UnfiledContainerChild, String, String)}
*/
public UnfiledContainerChild createUnfiledContainerChild(UnfiledContainerChild unfiledContainerChildModel, String unfiledContainerId) throws Exception
public UnfiledContainerChild createUnfiledContainerChild(UnfiledContainerChild unfiledContainerChildModel, String unfiledContainerId)
{
mandatoryObject("unfiledContainerChildModel", unfiledContainerChildModel);
mandatoryString("unfiledContainerId", unfiledContainerId);
@@ -159,7 +160,7 @@ public class UnfiledContainerAPI extends RMModelRequest
* @param unfiledContainerId The identifier of an unfiled container
* @param parameters The URL parameters to add
* @return The created {@link UnfiledContainerChild}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>{@code unfiledContainerId} is not a valid format or {@code unfiledContainerChildModel} is invalid</li>
* <li>authentication fails</li>
@@ -169,7 +170,7 @@ public class UnfiledContainerAPI extends RMModelRequest
* <li>model integrity exception, including node name with invalid characters</li>
* </ul>
*/
public UnfiledContainerChild createUnfiledContainerChild(UnfiledContainerChild unfiledContainerChildModel, String unfiledContainerId, String parameters) throws Exception
public UnfiledContainerChild createUnfiledContainerChild(UnfiledContainerChild unfiledContainerChildModel, String unfiledContainerId, String parameters)
{
mandatoryObject("unfiledContainerChildModel", unfiledContainerChildModel);
mandatoryString("unfiledContainerId", unfiledContainerId);
@@ -190,9 +191,9 @@ public class UnfiledContainerAPI extends RMModelRequest
* @param unfiledContainerChildContent {@link File} pointing to the content of the electronic record to be created
* @param unfiledContainerId The identifier of a unfiled container
* @return newly created {@link UnfiledContainerChild}
* @throws Exception for invalid recordModel JSON strings
* @throws RuntimeException for invalid recordModel JSON strings
*/
public UnfiledContainerChild uploadRecord(UnfiledContainerChild unfiledContainerChildModel, String unfiledContainerId, File unfiledContainerChildContent) throws Exception
public UnfiledContainerChild uploadRecord(UnfiledContainerChild unfiledContainerChildModel, String unfiledContainerId, File unfiledContainerChildContent)
{
mandatoryObject("unfiledContainerChildModel", unfiledContainerChildModel);
mandatoryObject("unfiledContainerChildContent", unfiledContainerChildContent);
@@ -208,7 +209,15 @@ public class UnfiledContainerAPI extends RMModelRequest
* to the request.
*/
RequestSpecBuilder builder = getRmRestWrapper().configureRequestSpec();
JsonNode root = new ObjectMapper().readTree(toJson(unfiledContainerChildModel, UnfiledContainerChild.class, UnfiledContainerChildMixin.class));
JsonNode root;
try
{
root = new ObjectMapper().readTree(toJson(unfiledContainerChildModel, UnfiledContainerChild.class, UnfiledContainerChildMixin.class));
}
catch (IOException e)
{
throw new RuntimeException("Failed to convert model to JSON.", e);
}
// add request fields
Iterator<String> fieldNames = root.fieldNames();
while (fieldNames.hasNext())
@@ -225,7 +234,7 @@ public class UnfiledContainerAPI extends RMModelRequest
/**
* see {@link #updateUnfiledContainer(UnfiledContainer, String, String)
*/
public UnfiledContainer updateUnfiledContainer(UnfiledContainer unfiledContainerModel, String unfiledContainerId) throws Exception
public UnfiledContainer updateUnfiledContainer(UnfiledContainer unfiledContainerModel, String unfiledContainerId)
{
mandatoryObject("unfiledContainerModel", unfiledContainerModel);
mandatoryString("unfiledContainerId", unfiledContainerId);
@@ -240,7 +249,7 @@ public class UnfiledContainerAPI extends RMModelRequest
* @param unfiledContainerId The identifier of an unfiled record container
* @param parameters The URL parameters to add
* @param returns The updated {@link UnfiledContainer}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>the update request is invalid or {@code unfiledContainerId} is not a valid format or {@code unfiledContainerModel} is invalid</li>
* <li>authentication fails</li>
@@ -250,7 +259,7 @@ public class UnfiledContainerAPI extends RMModelRequest
* <li>model integrity exception, including file name with invalid characters</li>
* </ul>
*/
public UnfiledContainer updateUnfiledContainer(UnfiledContainer unfiledContainerModel, String unfiledContainerId, String parameters) throws Exception
public UnfiledContainer updateUnfiledContainer(UnfiledContainer unfiledContainerModel, String unfiledContainerId, String parameters)
{
mandatoryObject("unfiledContainerModel", unfiledContainerModel);
mandatoryString("unfiledContainerId", unfiledContainerId);

View File

@@ -40,6 +40,7 @@ import static org.springframework.http.HttpMethod.PUT;
import static org.testng.Assert.fail;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import com.fasterxml.jackson.databind.JsonNode;
@@ -86,7 +87,7 @@ public class UnfiledRecordFolderAPI extends RMModelRequest
* @param unfiledRecordFolderId The identifier of a unfiled record folder
* @param parameters The URL parameters to add
* @return The {@link UnfiledRecordFolder} for the given {@code unfiledRecordFolderId}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>{@code unfiledRecordFolderId} is not a valid format</li>
* <li>authentication fails</li>
@@ -122,7 +123,7 @@ public class UnfiledRecordFolderAPI extends RMModelRequest
* @param unfiledRecordFolderId The identifier of an unfiled records folder
* @param parameters The URL parameters to add
* @return The {@link UnfiledRecordFolderChildCollection} for the given {@code unfiledRecordFolderId}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>authentication fails</li>
* <li>current user does not have permission to read {@code unfiledRecordFolderId}</li>
@@ -144,7 +145,7 @@ public class UnfiledRecordFolderAPI extends RMModelRequest
/**
* see {@link #createUnfiledRecordFolderChild(UnfiledContainerChild, String, String)}
*/
public UnfiledContainerChild createUnfiledRecordFolderChild(UnfiledContainerChild unfiledRecordFolderChildModel, String unfiledRecordFolderId) throws Exception
public UnfiledContainerChild createUnfiledRecordFolderChild(UnfiledContainerChild unfiledRecordFolderChildModel, String unfiledRecordFolderId)
{
mandatoryObject("unfiledRecordFolderChildModel", unfiledRecordFolderChildModel);
mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId);
@@ -159,7 +160,7 @@ public class UnfiledRecordFolderAPI extends RMModelRequest
* @param unfiledRecordFolderId The identifier of an unfiled folder
* @param parameters The URL parameters to add
* @return The created {@link UnfiledRecordFolderChild}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>{@code unfiledRecordFolderId} is not a valid format or {@code unfiledRecordFolderChildModel} is invalid</li>
* <li>authentication fails</li>
@@ -169,7 +170,7 @@ public class UnfiledRecordFolderAPI extends RMModelRequest
* <li>model integrity exception, including node name with invalid characters</li>
* </ul>
*/
public UnfiledContainerChild createUnfiledRecordFolderChild(UnfiledContainerChild unfiledRecordFolderChildModel, String unfiledRecordFolderId, String parameters) throws Exception
public UnfiledContainerChild createUnfiledRecordFolderChild(UnfiledContainerChild unfiledRecordFolderChildModel, String unfiledRecordFolderId, String parameters)
{
mandatoryObject("unfiledRecordFolderChildModel", unfiledRecordFolderChildModel);
mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId);
@@ -190,9 +191,9 @@ public class UnfiledRecordFolderAPI extends RMModelRequest
* @param unfiledRecordFolderChildContent {@link File} pointing to the content of the electronic record to be created
* @param unfiledRecordFolderId The identifier of a unfiled record folder
* @return newly created {@link UnfiledContainerChild}
* @throws Exception for invalid recordModel JSON strings
* @throws RuntimeException for invalid recordModel JSON strings
*/
public UnfiledContainerChild uploadRecord(UnfiledContainerChild unfiledRecordFolderChildModel, String unfiledRecordFolderId, File unfiledRecordFolderChildContent) throws Exception
public UnfiledContainerChild uploadRecord(UnfiledContainerChild unfiledRecordFolderChildModel, String unfiledRecordFolderId, File unfiledRecordFolderChildContent)
{
mandatoryObject("unfiledRecordFolderChildModel", unfiledRecordFolderChildModel);
mandatoryObject("unfiledRecordFolderChildContent", unfiledRecordFolderChildContent);
@@ -208,7 +209,15 @@ public class UnfiledRecordFolderAPI extends RMModelRequest
* to the request.
*/
RequestSpecBuilder builder = getRmRestWrapper().configureRequestSpec();
JsonNode root = new ObjectMapper().readTree(toJson(unfiledRecordFolderChildModel, UnfiledContainerChild.class, UnfiledContainerChildMixin.class));
JsonNode root;
try
{
root = new ObjectMapper().readTree(toJson(unfiledRecordFolderChildModel, UnfiledContainerChild.class, UnfiledContainerChildMixin.class));
}
catch (IOException e)
{
throw new RuntimeException("Failed to convert model to JSON.", e);
}
// add request fields
Iterator<String> fieldNames = root.fieldNames();
while (fieldNames.hasNext())
@@ -225,7 +234,7 @@ public class UnfiledRecordFolderAPI extends RMModelRequest
/**
* see {@link #updateUnfiledRecordFolder(UnfiledRecordFolder, String, String)
*/
public UnfiledRecordFolder updateUnfiledRecordFolder(UnfiledRecordFolder unfiledRecordFolderModel, String unfiledRecordFolderId) throws Exception
public UnfiledRecordFolder updateUnfiledRecordFolder(UnfiledRecordFolder unfiledRecordFolderModel, String unfiledRecordFolderId)
{
mandatoryObject("unfiledRecordFolderModel", unfiledRecordFolderModel);
mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId);
@@ -240,7 +249,7 @@ public class UnfiledRecordFolderAPI extends RMModelRequest
* @param unfiledRecordFolderId The identifier of an unfiled record folder
* @param parameters The URL parameters to add
* @param returns The updated {@link UnfiledRecordFolder}
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>the update request is invalid or {@code unfiledRecordFolderId} is not a valid format or {@code unfiledRecordFolderModel} is invalid</li>
* <li>authentication fails</li>
@@ -250,7 +259,7 @@ public class UnfiledRecordFolderAPI extends RMModelRequest
* <li>model integrity exception, including file name with invalid characters</li>
* </ul>
*/
public UnfiledRecordFolder updateUnfiledRecordFolder(UnfiledRecordFolder unfiledRecordFolderModel, String unfiledRecordFolderId, String parameters) throws Exception
public UnfiledRecordFolder updateUnfiledRecordFolder(UnfiledRecordFolder unfiledRecordFolderModel, String unfiledRecordFolderId, String parameters)
{
mandatoryObject("unfiledRecordFolderModel", unfiledRecordFolderModel);
mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId);
@@ -268,7 +277,7 @@ public class UnfiledRecordFolderAPI extends RMModelRequest
* Deletes an unfiled record folder.
*
* @param unfiledRecordFolderId The identifier of a unfiled record folder
* @throws Exception for the following cases:
* @throws RuntimeException for the following cases:
* <ul>
* <li>{@code unfiledRecordFolderId} is not a valid format</li>
* <li>authentication fails</li>