diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java
index b899a1306a..d2edca7279 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java
@@ -27,6 +27,7 @@
package org.alfresco.rest.core;
import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
+import org.alfresco.rest.rm.community.requests.igCoreAPI.FilesAPI;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RMSiteAPI;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RecordsAPI;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RestIGCoreAPI;
@@ -95,4 +96,14 @@ public class RestAPIFactory
{
return getRestIGCoreAPI(userModel).usingRecords();
}
+
+ public FilesAPI getFilesAPI()
+ {
+ return getRestIGCoreAPI(null).usingFiles();
+ }
+
+ public FilesAPI getFilesAPI(UserModel userModel)
+ {
+ return getRestIGCoreAPI(userModel).usingFiles();
+ }
}
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentFields.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentFields.java
index 68b8a3def0..442e3e15df 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentFields.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentFields.java
@@ -40,6 +40,7 @@ public class FilePlanComponentFields
public static final String ENTRY = "entry";
public static final String PROPERTIES = "properties";
public static final String PROPERTIES_TITLE = "cm:title";
+ public static final String PROPERTIES_RECORD_ID = "rma:identifier";
public static final String PROPERTIES_VITAL_RECORD_INDICATOR = "rma:vitalRecordIndicator";
public static final String PROPERTIES_HOLD_REASON = "rma:holdReason";
public static final String PROPERTIES_DESCRIPTION = "cm:description";
@@ -50,7 +51,7 @@ public class FilePlanComponentFields
public static final String PROPERTIES_LOCATION = "rma:location";
public static final String PROPERTIES_IS_CLOSED = "rma:isClosed"; // not to be confused with IS_CLOSED!
public static final String IS_COMPLETED = "isCompleted";
-
+
// for non-electronic records
public static final String PROPERTIES_BOX = "rma:box";
public static final String PROPERTIES_FILE = "rma:file";
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentProperties.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentProperties.java
index 4dee1bef31..4313910e50 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentProperties.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentProperties.java
@@ -39,6 +39,7 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SUPPLEMENTAL_MARKING_LIST;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ID;
import java.util.List;
@@ -106,4 +107,7 @@ public class FilePlanComponentProperties
@JsonProperty(value = PROPERTIES_PHYSICAL_SIZE, required = false)
private Integer physicalSize;
+
+ @JsonProperty(value = PROPERTIES_RECORD_ID, required = false)
+ private String recordId;
}
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/FilesAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/FilesAPI.java
new file mode 100644
index 0000000000..d88800800d
--- /dev/null
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/FilesAPI.java
@@ -0,0 +1,97 @@
+/*
+ * #%L
+ * Alfresco Records Management Module
+ * %%
+ * Copyright (C) 2005 - 2017 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * 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 .
+ * #L%
+ */
+package org.alfresco.rest.rm.community.requests.igCoreAPI;
+
+import static com.jayway.restassured.RestAssured.given;
+
+import static org.alfresco.rest.core.RestRequest.requestWithBody;
+import static org.alfresco.rest.core.RestRequest.simpleRequest;
+import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryObject;
+import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString;
+import static org.alfresco.rest.rm.community.util.PojoUtility.toJson;
+import static org.apache.commons.lang3.StringUtils.EMPTY;
+import static org.springframework.http.HttpMethod.POST;
+
+import com.jayway.restassured.response.Response;
+import com.jayway.restassured.response.ResponseBody;
+
+import org.alfresco.rest.core.RMRestWrapper;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
+import org.alfresco.rest.rm.community.model.fileplancomponents.RecordBodyFile;
+import org.alfresco.rest.rm.community.requests.RMModelRequest;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+/**
+ * Files REST API Wrapper
+ *
+ * @author Kristijan Conkas
+ * @since 2.6
+ */
+@Component
+@Scope (value = "prototype")
+public class FilesAPI extends RMModelRequest
+{
+ /**
+ * @param rmRestWrapper
+ */
+ public FilesAPI(RMRestWrapper rmRestWrapper)
+ {
+ super(rmRestWrapper);
+ }
+
+ /**
+ * Declare file as record
+ * @param fileId The Id of a file to declare as record
+ * @param parameters Request parameters, refer to API documentation for more details
+ * @return The {@link FilePlanComponent} for created record
+ * @throws Exception
+ */
+ public FilePlanComponent declareAsRecord(String fileId, String parameters) throws Exception
+ {
+ mandatoryString("fileId", fileId);
+
+ return getRMRestWrapper().processModel(FilePlanComponent.class, simpleRequest(
+ POST,
+ "/files/{fileId}/declare?{parameters}",
+ fileId,
+ parameters
+ ));
+ }
+
+ /**
+ * A no-parameter version of {@link FilesAPI#declareAsRecord}
+ * @param fileId The Id of a file to declare as record
+ * @return The {@link FilePlanComponent} for created record
+ * @throws Exception
+ */
+ public FilePlanComponent declareAsRecord(String fileId) throws Exception
+ {
+ return declareAsRecord(fileId, EMPTY);
+ }
+}
+
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java
index e582d9a8a0..85eb904a4e 100644
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java
+++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java
@@ -87,4 +87,14 @@ public class RestIGCoreAPI extends RMModelRequest
{
return new RecordsAPI(getRMRestWrapper());
}
+
+ /**
+ * Provides DSL on all REST calls under files/...
API path
+ *
+ * @return {@link FilesAPI}
+ */
+ public FilesAPI usingFiles()
+ {
+ return new FilesAPI(getRMRestWrapper());
+ }
}