diff --git a/README.txt b/README.txt index f31803686a..b46013c3f5 100644 --- a/README.txt +++ b/README.txt @@ -95,9 +95,6 @@ Follow these instructions install licence and Outlook plugin: - http://docs.alfresco.com/outlook2.1/tasks/Outlook-install_v2.html - - - SNAPSHOT dependencies: ---------------------- @@ -114,6 +111,7 @@ Code Formatting: This project follows the usual Alfresco Coding Standards. If you use Eclipse or IntelliJ, there are settings inside the ide-config directory for you to import. + Surf build errors: ------------------ @@ -121,3 +119,11 @@ If you get: [ERROR] Failed to execute goal on project alfresco-rm-community-share: Could not resolve dependencies for project org.alfresco:alfresco-rm-community-share:amp:2.6-SNAPSHOT: Failed to collect dependencies at org.alfresco.surf:spring-surf-api:jar:6.3 -> org.alfresco.surf:spring-surf:jar:${dependency.surf.version}: Failed to read artifact descriptor for org.alfresco.surf:spring-surf:jar:${dependency.surf.version}: Could not transfer artifact org.alfresco.surf:spring-surf:pom:${dependency.surf.version} from/to alfresco-internal (https://artifacts.alfresco.com/nexus/content/groups/private): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1] then please re-run with -Ddependency.surf.version=6.3 + + +Install lombok plugin for IDEs: +------------------------------- + +To allow automation and benchmark projects to be built within an IDE the lombok 'plugin' needs to be installed. + +Execute lombok.jar (doubleclick it, or run java -jar lombok.jar). Follow instructions. 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 364790369c..02cdee138f 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 @@ -47,6 +47,7 @@ public class FilePlanComponentFields public static final String PROPERTIES_VITAL_RECORD_INDICATOR = "rma:vitalRecordIndicator"; public static final String PROPERTIES_REVIEW_PERIOD = "rma:reviewPeriod"; public static final String PROPERTIES_OWNER = "cm:owner"; + public static final String PROPERTIES_AUTHOR="cm:author"; /** Common properties for record folders and records */ public static final String PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE = "rma:recordSearchHasDispositionSchedule"; diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/RecordProperties.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/RecordProperties.java index 7c94fa705d..661897be07 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/RecordProperties.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/RecordProperties.java @@ -27,6 +27,7 @@ package org.alfresco.rest.rm.community.model.record; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_AUTHOR; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_BOX; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DATE_FILED; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DATE_TIME_ORIGINAL; @@ -62,6 +63,7 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_USER_ID; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_CREATION_DATE; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import org.alfresco.rest.rm.community.model.common.Owner; @@ -84,6 +86,7 @@ import lombok.NoArgsConstructor; @EqualsAndHashCode(callSuper = true) @NoArgsConstructor @AllArgsConstructor +@JsonIgnoreProperties(ignoreUnknown = true) public class RecordProperties extends TestModel { /*************************/ @@ -196,4 +199,7 @@ public class RecordProperties extends TestModel @JsonProperty (PROPERTIES_OWNER) private Owner owner; + + @JsonProperty(PROPERTIES_AUTHOR) + private String author; } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChildProperties.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChildProperties.java index 7da874715a..400033b40b 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChildProperties.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChildProperties.java @@ -130,7 +130,7 @@ public class RecordCategoryChildProperties extends TestModel private Boolean recordSearchDispositionEventsEligible; @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS) - private String recordSearchDispositionInstructions; + private String recordSearchDispositionInstructions; @JsonProperty (PROPERTIES_OWNER) private Owner owner; diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/Transfer.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/Transfer.java index 098f04a6a9..7df99b898c 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/Transfer.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/Transfer.java @@ -29,12 +29,11 @@ package org.alfresco.rest.rm.community.model.transfer; import java.util.List; -import org.alfresco.rest.model.RestByUserModel; -import org.alfresco.rest.rm.community.model.common.Path; -import org.alfresco.utility.model.TestModel; - import com.fasterxml.jackson.annotation.JsonProperty; +import org.alfresco.rest.model.RestByUserModel; +import org.alfresco.utility.model.TestModel; + import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfercontainer/TransferContainer.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfercontainer/TransferContainer.java index 6ae938db2b..5c56bd3eea 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfercontainer/TransferContainer.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfercontainer/TransferContainer.java @@ -29,12 +29,11 @@ package org.alfresco.rest.rm.community.model.transfercontainer; import java.util.List; -import org.alfresco.rest.model.RestByUserModel; -import org.alfresco.rest.rm.community.model.common.Path; -import org.alfresco.utility.model.TestModel; - import com.fasterxml.jackson.annotation.JsonProperty; +import org.alfresco.rest.model.RestByUserModel; +import org.alfresco.utility.model.TestModel; + import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerChildProperties.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerChildProperties.java index f8bde1a223..216c01500b 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerChildProperties.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerChildProperties.java @@ -57,13 +57,11 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_X_RESOLUTION; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_Y_RESOLUTION; -import org.alfresco.rest.rm.community.model.common.Owner; -import org.alfresco.rest.rm.community.model.common.ReviewPeriod; -import org.alfresco.rest.rm.community.util.ReviewPeriodSerializer; -import org.alfresco.utility.model.TestModel; - import com.fasterxml.jackson.annotation.JsonProperty; +import org.alfresco.rest.rm.community.model.common.Owner; +import org.alfresco.utility.model.TestModel; + import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -155,7 +153,7 @@ public class UnfiledContainerChildProperties extends TestModel @JsonProperty (PROPERTIES_Y_RESOLUTION) private Double yResolution; - + @JsonProperty (PROPERTIES_ORIGINAL_NAME) private String originalName; diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerProperties.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerProperties.java index a7ab94c039..5bd5de6821 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerProperties.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerProperties.java @@ -27,15 +27,12 @@ package org.alfresco.rest.rm.community.model.unfiledcontainer; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE; - -import org.alfresco.rest.rm.community.model.common.Owner; -import org.alfresco.utility.model.TestModel; import com.fasterxml.jackson.annotation.JsonProperty; +import org.alfresco.utility.model.TestModel; + import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledContainerAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledContainerAPI.java index 916b2488fa..9abf0e2664 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledContainerAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledContainerAPI.java @@ -41,19 +41,18 @@ import static org.testng.Assert.fail; import java.io.File; import java.util.Iterator; -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainer; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildCollection; -import org.alfresco.rest.rm.community.requests.RMModelRequest; -import org.alfresco.rest.rm.community.util.FilePlanComponentMixIn; - import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.restassured.builder.RequestSpecBuilder; import com.jayway.restassured.http.ContentType; +import org.alfresco.rest.core.RMRestWrapper; +import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainer; +import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; +import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildCollection; +import org.alfresco.rest.rm.community.requests.RMModelRequest; +import org.alfresco.rest.rm.community.util.UnfiledContainerChildMixin; + /** * Unfiled Container REST API Wrapper * @@ -209,7 +208,7 @@ public class UnfiledContainerAPI extends RMModelRequest * to the request. */ RequestSpecBuilder builder = getRmRestWrapper().configureRequestSpec(); - JsonNode root = new ObjectMapper().readTree(toJson(unfiledContainerChildModel, Record.class, FilePlanComponentMixIn.class)); + JsonNode root = new ObjectMapper().readTree(toJson(unfiledContainerChildModel, UnfiledContainerChild.class, UnfiledContainerChildMixin.class)); // add request fields Iterator fieldNames = root.fieldNames(); while (fieldNames.hasNext()) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledRecordFolderAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledRecordFolderAPI.java index b13a564329..6a2048c00d 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledRecordFolderAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledRecordFolderAPI.java @@ -42,19 +42,18 @@ import static org.testng.Assert.fail; import java.io.File; import java.util.Iterator; -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildCollection; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledRecordFolder; -import org.alfresco.rest.rm.community.requests.RMModelRequest; -import org.alfresco.rest.rm.community.util.FilePlanComponentMixIn; - import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.restassured.builder.RequestSpecBuilder; import com.jayway.restassured.http.ContentType; +import org.alfresco.rest.core.RMRestWrapper; +import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; +import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildCollection; +import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledRecordFolder; +import org.alfresco.rest.rm.community.requests.RMModelRequest; +import org.alfresco.rest.rm.community.util.UnfiledContainerChildMixin; + /** * Unfiled Record Folders REST API Wrapper * @@ -209,7 +208,7 @@ public class UnfiledRecordFolderAPI extends RMModelRequest * to the request. */ RequestSpecBuilder builder = getRmRestWrapper().configureRequestSpec(); - JsonNode root = new ObjectMapper().readTree(toJson(unfiledRecordFolderChildModel, Record.class, FilePlanComponentMixIn.class)); + JsonNode root = new ObjectMapper().readTree(toJson(unfiledRecordFolderChildModel, UnfiledContainerChild.class, UnfiledContainerChildMixin.class)); // add request fields Iterator fieldNames = root.fieldNames(); while (fieldNames.hasNext()) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/UnfiledContainerChildMixin.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/UnfiledContainerChildMixin.java new file mode 100644 index 0000000000..bcf238d6d9 --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/UnfiledContainerChildMixin.java @@ -0,0 +1,49 @@ +/* + * #%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.util; + +import com.fasterxml.jackson.annotation.JsonUnwrapped; + +import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildProperties; + +/** + * Mix class for Record POJO class + * Mix-in annotations are: a way to associate annotations with classes + * without modifying (target) classes themselves. + * + * @author Tuna Aksoy + * @since 2.6 + */ +public abstract class UnfiledContainerChildMixin +{ + /** + * Annotation used to indicate that a property should be serialized "unwrapped" + * Its properties are instead included as properties of its containing Object + */ + @JsonUnwrapped + abstract UnfiledContainerChildProperties getProperties(); +} diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java index 6d33a69c12..10d971d9f0 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java @@ -54,7 +54,6 @@ import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; /** @@ -77,8 +76,6 @@ public class RMRolesAndActionsAPI extends BaseAPI @Autowired private AlfrescoHttpClientFactory alfrescoHttpClientFactory; - private ApplicationContext applicationContext; - /** user service */ @Autowired private UserService userService; diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java index 21c14ea732..38d4b2959d 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java @@ -28,6 +28,7 @@ package org.alfresco.rest.rm.community.base; import static lombok.AccessLevel.PROTECTED; +import static org.alfresco.rest.rm.community.base.TestData.ELECTRONIC_RECORD_NAME; import static org.alfresco.rest.rm.community.base.TestData.RECORD_CATEGORY_TITLE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; @@ -35,10 +36,11 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createRecordCategoryChildModel; import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createRecordCategoryModel; +import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createTempFile; import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createUnfiledContainerChildModel; import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createStandardRMSiteModel; import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; @@ -52,6 +54,7 @@ import java.util.List; import org.alfresco.rest.RestTest; import org.alfresco.rest.core.RestAPIFactory; import org.alfresco.rest.rm.community.model.fileplan.FilePlan; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType; import org.alfresco.rest.rm.community.model.record.Record; import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; @@ -334,8 +337,17 @@ public class BaseRMRestTest extends RestTest */ public UnfiledContainerChild createUnfiledContainerChild(UserModel user, String parentId, String childName, String nodeType) throws Exception { + UnfiledContainerChild child = null; UnfiledContainerChild childModel = createUnfiledContainerChildModel(childName, nodeType); - UnfiledContainerChild child = getRestAPIFactory().getUnfiledContainersAPI(user).createUnfiledContainerChild(childModel, parentId); + + if (FilePlanComponentType.CONTENT_TYPE.equals(nodeType)) + { + child = getRestAPIFactory().getUnfiledContainersAPI(user).uploadRecord(childModel, parentId, createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME)); + } + else + { + child = getRestAPIFactory().getUnfiledContainersAPI(user).createUnfiledContainerChild(childModel, parentId); + } assertStatusCode(CREATED); return child; diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java index 3c799ebb61..a1ebcb2d11 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java @@ -159,6 +159,22 @@ public interface TestData }; } + /** + * Data Provider with: + * with the object types for creating a Record Category Child + * + * @return record category child type + */ + @DataProvider + public static Object[][] categoryChild() + { + return new String[][] { + { RECORD_FOLDER_TYPE }, + { FOLDER_TYPE }, + { RECORD_CATEGORY_TYPE } + }; + } + /** * Invalid root level types, at unfiled record folder/unfiled containers container level that shouldn't be possible to create */ @@ -171,7 +187,9 @@ public interface TestData { RECORD_CATEGORY_TYPE }, { RECORD_FOLDER_TYPE }, { TRANSFER_CONTAINER_TYPE }, - { UNFILED_CONTAINER_TYPE } + { TRANSFER_TYPE }, + { UNFILED_CONTAINER_TYPE }, + }; } } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplans/FilePlanTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplans/FilePlanTests.java index eba2d7e853..47047a07a2 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplans/FilePlanTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplans/FilePlanTests.java @@ -45,12 +45,14 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING; import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER; import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; +import static org.springframework.http.HttpStatus.CONFLICT; import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.FORBIDDEN; import static org.springframework.http.HttpStatus.NOT_FOUND; import static org.springframework.http.HttpStatus.OK; import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; @@ -322,6 +324,56 @@ public class FilePlanTests extends BaseRMRestTest assertNotNull(rootRecordCategoryProperties.getIdentifier()); } + /** + *
+     * Given a root category
+     * When I ask the API to create a root category having the same name
+     * Then  the response code received is 409 - name clashes with an existing node
+     *
+ *
+     * Given a root category
+     * When I ask the API to create a root category having the same name  with autoRename parameter on true
+     * Then the record category is created the record category has a unique name by adding an integer suffix
+     * 
+ */ + @Test + @Bug(id = "RM-5116") + public void createDuplicateCategories() throws Exception + { + String categoryName = "Category name " + getRandomAlphanumeric(); + String categoryTitle = "Category title " + getRandomAlphanumeric(); + + + // Create the root record category + RecordCategory recordCategory = RecordCategory.builder() + .name(categoryName) + .properties(RecordCategoryProperties.builder() + .title(categoryTitle) + .build()) + .build(); + // Create the root record category + RecordCategory rootRecordCategory = getRestAPIFactory().getFilePlansAPI().createRootRecordCategory(recordCategory,FILE_PLAN_ALIAS); + + // Verify the status code + assertStatusCode(CREATED); + assertEquals(rootRecordCategory.getName(), categoryName); + + // Create the same root record category + getRestAPIFactory().getFilePlansAPI().createRootRecordCategory(recordCategory, FILE_PLAN_ALIAS); + + // Verify the status code + assertStatusCode(CONFLICT); + + //create the same category with autoRename parameter on true + RecordCategory rootRecordCategoryAutoRename = getRestAPIFactory().getFilePlansAPI() + .createRootRecordCategory(recordCategory, FILE_PLAN_ALIAS,"autoRename=true"); + + // Verify the status code + assertStatusCode(CREATED); + assertNotEquals(rootRecordCategoryAutoRename.getName(), categoryName); + assertTrue(rootRecordCategoryAutoRename.getName().startsWith(categoryName)); + } + @Test public void listFilePlanChildren() throws Exception { diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/RecordCategoryTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/RecordCategoryTests.java index 92d1073588..03359c0bf7 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/RecordCategoryTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/RecordCategoryTests.java @@ -38,8 +38,10 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.TITLE_PREFIX; +import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createRecordCategoryChildModel; import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; import static org.springframework.http.HttpStatus.BAD_REQUEST; +import static org.springframework.http.HttpStatus.CONFLICT; import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.NOT_FOUND; import static org.springframework.http.HttpStatus.NO_CONTENT; @@ -47,11 +49,13 @@ import static org.springframework.http.HttpStatus.OK; import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.NoSuchElementException; @@ -66,7 +70,10 @@ import org.alfresco.rest.rm.community.model.recordfolder.RecordFolder; import org.alfresco.rest.rm.community.requests.gscore.api.FilePlanAPI; import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI; import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; +import org.alfresco.rest.v0.RecordCategoriesAPI; +import org.alfresco.rest.core.v0.BaseAPI.RETENTION_SCHEDULE; import org.alfresco.utility.report.Bug; +import org.springframework.beans.factory.annotation.Autowired; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -83,6 +90,9 @@ public class RecordCategoryTests extends BaseRMRestTest private static final int NUMBER_OF_CHILDREN = 10; private static final int NUMBER_OF_FOLDERS = 5; + @Autowired + private RecordCategoriesAPI recordCategoriesAPI; + /** * Invalid containers that cannot be deleted with record category end-point */ @@ -287,6 +297,43 @@ public class RecordCategoryTests extends BaseRMRestTest assertEquals(folderProperties.getTitle(), TITLE_PREFIX + RECORD_FOLDER_NAME); assertNotNull(folderProperties.getIdentifier()); } + @Test + ( + dataProviderClass = TestData.class, + dataProvider = "categoryChild" + ) + @Bug(id = "RM-5116") + public void createdDuplicateChild(String childType)throws Exception + { + // create a root category + String rootRecordCategory = createRootCategory(RECORD_CATEGORY_NAME + getRandomAlphanumeric()).getId(); + + // Create the record category child + RecordCategoryChild recordFolder = createRecordCategoryChild(rootRecordCategory, RECORD_FOLDER_NAME, childType); + + // check the response code + assertStatusCode(CREATED); + assertEquals(recordFolder.getName(), RECORD_FOLDER_NAME); + + // Create a record category child with the same name as the exiting one + + RecordCategoryChild recordFolderDuplicate = getRestAPIFactory().getRecordCategoryAPI().createRecordCategoryChild( + createRecordCategoryChildModel(RECORD_FOLDER_NAME, childType), rootRecordCategory); + + // check the response code + assertStatusCode(CONFLICT); + + // Create a record folder with the same name as the exiting one and with the autoRename parameter on true + recordFolderDuplicate = getRestAPIFactory().getRecordCategoryAPI() + .createRecordCategoryChild(createRecordCategoryChildModel(RECORD_FOLDER_NAME, + childType), + rootRecordCategory, "autoRename=true"); + // check the response code + assertStatusCode(CREATED); + assertNotEquals(recordFolderDuplicate.getName(), RECORD_FOLDER_NAME); + assertTrue(recordFolderDuplicate.getName().contains(RECORD_FOLDER_NAME)); + } + /** *
      * Given that a record category exists
@@ -294,17 +341,37 @@ public class RecordCategoryTests extends BaseRMRestTest
      * When I ask the API to get me the children of the record category
      * Then I am returned the contained record categories and record folders and their details
      * 
+ *
+     * Given that a record category with a disposition schedule exists
+     * And contains a number of record categories and record folders
+     * When I ask the API to get me the children of the record category
+     * Then I am returned the contained record categories and record folders but not the disposition schedule
+     * 
*/ @Test - ( - description = "Get children of a record category" - ) + ( + description = "Get children of a record category excluding the disposition schedule" + ) + @Bug (id="RM-5115") public void getRecordCategoryChildren() throws Exception { // Create root level category RecordCategory rootRecordCategory = createRootCategory(getRandomAlphanumeric()); assertNotNull(rootRecordCategory.getId()); + // Create disposition schedule + String userName = getAdminUser().getUsername(); + String userPassword = getAdminUser().getPassword(); + String categoryName = rootRecordCategory.getName(); + recordCategoriesAPI.createRetentionSchedule(userName, userPassword, categoryName); + + // Add disposition schedule cut off step + HashMap cutOffStep = new HashMap<>(); + cutOffStep.put(RETENTION_SCHEDULE.NAME, "cutoff"); + cutOffStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, "day|2"); + cutOffStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Cut off after 2 days"); + recordCategoriesAPI.addDispositionScheduleSteps(userName, userPassword, categoryName, cutOffStep); + // Add record category children List children = new ArrayList(); for (int i=0; i < NUMBER_OF_CHILDREN; i++) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/RecordFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/RecordFolderTests.java index dde7d18a30..a72359c62d 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/RecordFolderTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/RecordFolderTests.java @@ -34,6 +34,7 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.IS_CLOSED; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FOLDER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE; @@ -105,7 +106,8 @@ public class RecordFolderTests extends BaseRMRestTest { UNFILED_CONTAINER_TYPE }, { UNFILED_RECORD_FOLDER_TYPE }, { TRANSFER_TYPE }, - { RECORD_CATEGORY_TYPE } + { RECORD_CATEGORY_TYPE }, + { FOLDER_TYPE } }; } @@ -370,9 +372,6 @@ public class RecordFolderTests extends BaseRMRestTest // Make a request to close the record folder RecordFolder updatedRecordFolder = recordFolderAPI.updateRecordFolder(recordFolderModel, recordFolder.getId()); - //FIXME - remove this workaround after RM-4921 is fixed. - updatedRecordFolder = recordFolderAPI.getRecordFolder(updatedRecordFolder.getId()); - // Verify that the record folder is closed now assertTrue(updatedRecordFolder.getProperties().getIsClosed()); @@ -386,9 +385,6 @@ public class RecordFolderTests extends BaseRMRestTest // Make a request to reopen the record folder updatedRecordFolder = recordFolderAPI.updateRecordFolder(recordFolderModel, recordFolder.getId()); - //FIXME - remove this workaround after RM-4921 is fixed. - updatedRecordFolder = recordFolderAPI.getRecordFolder(updatedRecordFolder.getId()); - // Verify that the record folder is open now assertFalse(updatedRecordFolder.getProperties().getIsClosed()); } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledcontainers/UnfiledContainerTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledcontainers/UnfiledContainerTests.java index 7bc5ac302d..9ab6fb25b9 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledcontainers/UnfiledContainerTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledcontainers/UnfiledContainerTests.java @@ -38,10 +38,13 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createUnfiledContainerChildModel; import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; import static org.springframework.http.HttpStatus.BAD_REQUEST; +import static org.springframework.http.HttpStatus.CONFLICT; +import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.OK; import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; @@ -61,6 +64,7 @@ import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledRecordFolder import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI; import org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil; import org.springframework.http.HttpStatus; +import org.alfresco.utility.report.Bug; import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; import org.testng.annotations.DataProvider; @@ -165,7 +169,7 @@ public class UnfiledContainerTests extends BaseRMRestTest public void createUnfiledRecordFolderChild(String folderType) throws Exception { String unfiledRecordFolderName = "UnfiledRecordFolder-" + getRandomAlphanumeric(); - UnfiledContainerChild unfiledRecordFolderChild = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, unfiledRecordFolderName, UNFILED_RECORD_FOLDER_TYPE); + UnfiledContainerChild unfiledRecordFolderChild = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, unfiledRecordFolderName, folderType); assertNotNull(unfiledRecordFolderChild.getId()); @@ -186,7 +190,40 @@ public class UnfiledContainerTests extends BaseRMRestTest assertEquals(unfiledRecordFolder.getParentId(), getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId()); } - + + @Test + ( description = "Create duplicate unfiled folder child", + dataProvider = "unfiledFolderTypes" + ) + @Bug(id ="RM-5116, RM-5148") + public void createDuplicateUnfiledFolderChild(String folderType) throws Exception + { + String unfiledRecordFolderName = "UnfiledRecordFolder-" + getRandomAlphanumeric(); + UnfiledContainerChild unfiledRecordFolderChild = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, + unfiledRecordFolderName, folderType); + + // Verify the status code + assertStatusCode(CREATED); + assertEquals(unfiledRecordFolderChild.getName(), unfiledRecordFolderName); + + // create the same unfiled folder + UnfiledContainerChild unfiledRecordFolderDuplicate = getRestAPIFactory().getUnfiledContainersAPI() + .createUnfiledContainerChild(createUnfiledContainerChildModel(unfiledRecordFolderName, folderType), + UNFILED_RECORDS_CONTAINER_ALIAS); + + // Verify the status code + assertStatusCode(CONFLICT); + + // create the same unfiled folder with the autoRename parameter on true + unfiledRecordFolderDuplicate = getRestAPIFactory().getUnfiledContainersAPI() + .createUnfiledContainerChild(createUnfiledContainerChildModel(unfiledRecordFolderName, folderType),UNFILED_RECORDS_CONTAINER_ALIAS,"autoRename=true"); + + //verify the response status code + assertStatusCode(CREATED); + assertNotEquals(unfiledRecordFolderDuplicate.getName(), unfiledRecordFolderName); + assertTrue(unfiledRecordFolderDuplicate.getName().startsWith(unfiledRecordFolderName)); + + } /** *
      * Given that an unfiled records container exists
@@ -396,7 +433,8 @@ public class UnfiledContainerTests extends BaseRMRestTest
         try
         {
             getRestAPIFactory().getUnfiledContainersAPI().createUnfiledContainerChild(unfiledFolderModel, UNFILED_RECORDS_CONTAINER_ALIAS);
-        } catch (Exception error)
+        }
+        catch (Exception error)
         {
         }
         // Verify the status code
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledrecordfolders/UnfiledRecordsFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledrecordfolders/UnfiledRecordsFolderTests.java
index 3e9c860a8c..4e09cee2e7 100644
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledrecordfolders/UnfiledRecordsFolderTests.java
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledrecordfolders/UnfiledRecordsFolderTests.java
@@ -487,8 +487,10 @@ public class UnfiledRecordsFolderTests extends BaseRMRestTest
                 assertTrue(record.getName().equals(createdComponent.getName()),
                             "The record name "+ record.getName()+" is not equal with the record name returned when creating the record " + createdComponent
                                         .getName());
-
-                assertTrue(record.getName().contains(record.getProperties().getIdentifier()));
+                String identifier = " \\(" + record.getProperties().getIdentifier() + "\\)";
+                String regex= "(" + NONELECTRONIC_RECORD_NAME + "|" + ELECTRONIC_RECORD_NAME + ")" + "[0-9]+" + identifier;
+                assertTrue(record.getName().matches(regex),
+                            "The record name:" + record.getName() + " doesn't match the expression " + regex);
                 assertTrue(createdComponent.getName().contains(createdComponent.getProperties().getIdentifier()));
                 assertEquals(createdComponent.getNodeType(), record.getNodeType());
 
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/FilePlanChildrenRelation.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/FilePlanChildrenRelation.java
index fce0877b72..d8c3e20dab 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/FilePlanChildrenRelation.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/FilePlanChildrenRelation.java
@@ -39,22 +39,23 @@ import java.util.Map;
 import java.util.Set;
 
 import org.alfresco.query.PagingResults;
-import org.alfresco.repo.activities.ActivityType;
 import org.alfresco.repo.node.getchildren.FilterProp;
+import org.alfresco.repo.node.integrity.IntegrityException;
 import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
 import org.alfresco.rest.api.impl.Util;
 import org.alfresco.rest.api.model.UserInfo;
 import org.alfresco.rest.framework.WebApiDescription;
 import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
 import org.alfresco.rest.framework.resource.RelationshipResource;
+import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction;
 import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
 import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
 import org.alfresco.rest.framework.resource.parameters.Parameters;
+import org.alfresco.rest.framework.webscripts.WithResponse;
 import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory;
 import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils;
 import org.alfresco.rm.rest.api.impl.SearchTypesFactory;
 import org.alfresco.rm.rest.api.model.FilePlan;
-import org.alfresco.rm.rest.api.model.Record;
 import org.alfresco.rm.rest.api.model.RecordCategory;
 import org.alfresco.service.cmr.model.FileFolderService;
 import org.alfresco.service.cmr.model.FileInfo;
@@ -63,6 +64,7 @@ import org.alfresco.service.namespace.QName;
 import org.alfresco.service.transaction.TransactionService;
 import org.alfresco.util.ParameterCheck;
 import org.springframework.beans.factory.InitializingBean;
+import org.springframework.extensions.webscripts.servlet.FormData;
 
 /**
  * File plan children relation
@@ -72,7 +74,9 @@ import org.springframework.beans.factory.InitializingBean;
  */
 @RelationshipResource(name="categories", entityResource = FilePlanEntityResource.class, title = "Category children of file plan")
 public class FilePlanChildrenRelation implements RelationshipResourceAction.Read,
-                                                 RelationshipResourceAction.Create, InitializingBean
+                                                 RelationshipResourceAction.Create,
+                                                 MultiPartRelationshipResourceAction.Create,
+                                                 InitializingBean
 {
     /** Record category type */
     public static final String RECORD_CATEGORY_TYPE = "rma:recordCategory";
@@ -198,8 +202,8 @@ public class FilePlanChildrenRelation implements RelationshipResourceAction.Read
                 for (RecordCategory nodeInfo : nodeInfos)
                 {
                     // Create the node
-                    NodeRef newNodeRef = apiUtils.createRMNode(parentNodeRef, nodeInfo.getName(), RECORD_CATEGORY_TYPE,
-                            nodeInfo.getProperties(), nodeInfo.getAspectNames());
+                    nodeInfo.setNodeType(RECORD_CATEGORY_TYPE);
+                    NodeRef newNodeRef = apiUtils.createRMNode(parentNodeRef, nodeInfo, parameters);
                     createdNodes.add(newNodeRef);
                 }
                 return createdNodes;
@@ -218,4 +222,13 @@ public class FilePlanChildrenRelation implements RelationshipResourceAction.Read
 
         return result;
     }
+
+    /**
+     * @see org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction.Create#create(java.lang.String, org.springframework.extensions.webscripts.servlet.FormData, org.alfresco.rest.framework.resource.parameters.Parameters, org.alfresco.rest.framework.webscripts.WithResponse)
+     */
+    @Override
+    public RecordCategory create(String entityResourceId, FormData formData, Parameters parameters, WithResponse withResponse)
+    {
+        throw new IntegrityException("Uploading records into file plan root is not allowed.", null);
+    }
 }
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/FilePlanEntityResource.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/FilePlanEntityResource.java
index 5593a55a2a..76df9f5308 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/FilePlanEntityResource.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/FilePlanEntityResource.java
@@ -55,8 +55,9 @@ import org.springframework.beans.factory.InitializingBean;
  * @since 2.6
  */
 @EntityResource(name = "file-plans", title = "File plans")
-public class FilePlanEntityResource
-        implements EntityResourceAction.ReadById, EntityResourceAction.Update, InitializingBean
+public class FilePlanEntityResource implements EntityResourceAction.ReadById,
+                                                EntityResourceAction.Update,
+                                                InitializingBean
 {
 
     private FilePlanComponentsApiUtils apiUtils;
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/FilePlanComponentsApiUtils.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/FilePlanComponentsApiUtils.java
index 62c70ea4c6..a6caf3b599 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/FilePlanComponentsApiUtils.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/FilePlanComponentsApiUtils.java
@@ -136,6 +136,12 @@ public class FilePlanComponentsApiUtils
             RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER,
             RecordsManagementModel.TYPE_HOLD_CONTAINER);
 
+    public static final List TYPES_CAN_USE_AUTORENAME = Arrays.asList(
+            RecordsManagementModel.TYPE_RECORD_CATEGORY,
+            RecordsManagementModel.TYPE_RECORD_FOLDER,
+            RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER,
+            RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER);
+
     /** RM Nodes API */
     private Nodes nodes;
     private FileFolderService fileFolderService;
@@ -600,27 +606,43 @@ public class FilePlanComponentsApiUtils
      * Create an RM node
      *
      * @param parentNodeRef  the parent of the node
-     * @param name  the name of the new node
-     * @param type  the type of the node
-     * @param properties properties to set on the new node
-     * @param aspects aspects to set on the new node
+     * @param nodeInfo  the node infos to create
+     * @param parameters  the object to get the parameters passed into the request
      * @return the new node
      */
-    public NodeRef createRMNode(NodeRef parentNodeRef, String name, String type, Map properties, List aspects)
+    public NodeRef createRMNode(NodeRef parentNodeRef, RMNode nodeInfo, Parameters parameters)
     {
         mandatory("parentNodeRef", parentNodeRef);
-        checkNotBlank(RMNode.PARAM_NAME, name);
-        checkNotBlank(RMNode.PARAM_NODE_TYPE, type);
+        mandatory("nodeInfo", nodeInfo);
+        mandatory("parameters", parameters);
+
+        String nodeName = nodeInfo.getName();
+        String nodeType = nodeInfo.getNodeType();
+        checkNotBlank(RMNode.PARAM_NAME, nodeName);
+        checkNotBlank(RMNode.PARAM_NODE_TYPE, nodeType);
 
         // Create the node
         NodeRef newNodeRef = null;
+        boolean autoRename = Boolean.valueOf(parameters.getParameter(RMNode.PARAM_AUTO_RENAME));
+
         try
         {
-            QName typeQName = nodes.createQName(type);
-            newNodeRef = fileFolderService.create(parentNodeRef, name, typeQName).getNodeRef();
+            QName typeQName = nodes.createQName(nodeType);
+
+            // Existing file/folder name handling
+            if (TYPES_CAN_USE_AUTORENAME.contains(typeQName) && autoRename)
+            {
+                NodeRef existingNode = nodeService.getChildByName(parentNodeRef, ContentModel.ASSOC_CONTAINS, nodeName);
+                if (existingNode != null)
+                {
+                    // File already exists, find a unique name
+                    nodeName = findUniqueName(parentNodeRef, nodeName);
+                }
+            }
+            newNodeRef = fileFolderService.create(parentNodeRef, nodeName, typeQName).getNodeRef();
 
             // Set the provided properties if any
-            Map qnameProperties = mapToNodeProperties(properties);
+            Map qnameProperties = mapToNodeProperties(nodeInfo.getProperties());
             if (qnameProperties != null)
             {
                 nodeService.addProperties(newNodeRef, qnameProperties);
@@ -630,18 +652,19 @@ public class FilePlanComponentsApiUtils
             if (!typeQName.equals(RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT)
                     && dictionaryService.isSubClass(typeQName, ContentModel.TYPE_CONTENT))
             {
-                writeContent(newNodeRef, name, new ByteArrayInputStream("".getBytes()), false);
+                writeContent(newNodeRef, nodeName, new ByteArrayInputStream("".getBytes()), false);
             }
 
             // Add the provided aspects if any
-            if (aspects != null)
+            List aspectNames = nodeInfo.getAspectNames();
+            if (aspectNames != null)
             {
-                nodes.addCustomAspects(newNodeRef, aspects, ApiNodesModelFactory.EXCLUDED_ASPECTS);
+                nodes.addCustomAspects(newNodeRef, aspectNames, ApiNodesModelFactory.EXCLUDED_ASPECTS);
             }
         }
         catch (InvalidTypeException ex)
         {
-            throw new InvalidArgumentException("The given type:'" + type + "' is invalid '");
+            throw new InvalidArgumentException("The given type:'" + nodeType + "' is invalid '");
         }
         catch(DuplicateAttributeException ex)
         {
@@ -962,7 +985,45 @@ public class FilePlanComponentsApiUtils
             activityPoster.postFileFolderActivity(activityType, null, TenantUtil.getCurrentDomain(), activityInfo.getSiteId(),
                     activityInfo.getParentNodeRef(), activityInfo.getNodeRef(), activityInfo.getFileName(), Activities.APP_TOOL,
                     Activities.RESTAPI_CLIENT, activityInfo.getFileInfo());
-
         }
     }
+    /**
+     * Creates a unique file name, if the upload component was configured to
+     * find a new unique name for clashing filenames.
+     *
+     * @param parentNodeRef the parent node
+     * @param fileName      the original fileName
+     * @return a new file name
+     */
+    private String findUniqueName(NodeRef parentNodeRef, String fileName)
+    {
+        int counter = 1;
+        String tmpFilename;
+        NodeRef existingFile;
+        do
+        {
+            int dotIndex = fileName.lastIndexOf('.');
+            if (dotIndex == 0)
+            {
+                // File didn't have a proper 'name' instead it
+                // had just a suffix and started with a ".", create "1.txt"
+                tmpFilename = counter + fileName;
+            }
+            else if (dotIndex > 0)
+            {
+                // Filename contained ".", create "fileName-1.txt"
+                tmpFilename = fileName.substring(0, dotIndex) + "-" + counter + fileName.substring(dotIndex);
+            }
+            else
+            {
+                // Filename didn't contain a dot at all, create "fileName-1"
+                tmpFilename = fileName + "-" + counter;
+            }
+            existingFile = nodeService.getChildByName(parentNodeRef, ContentModel.ASSOC_CONTAINS, tmpFilename);
+            counter++;
+
+        } while (existingFile != null);
+
+        return tmpFilename;
+    }
 }
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/SearchTypesFactory.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/SearchTypesFactory.java
index 2e103a9874..cbaee33f3b 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/SearchTypesFactory.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/SearchTypesFactory.java
@@ -198,6 +198,7 @@ public class SearchTypesFactory
             Boolean isRecordFolder = propertyWalker.getProperty(RecordCategoryChild.PARAM_IS_RECORD_FOLDER,
                     WhereClauseParser.EQUALS, Boolean.class);
             Boolean isRecordCategory = propertyWalker.getProperty(RecordCategoryChild.PARAM_IS_RECORD_CATEGORY, WhereClauseParser.EQUALS, Boolean.class);
+
             if ((isRecordFolder != null && isRecordFolder.booleanValue()) || (isRecordCategory != null && !isRecordCategory.booleanValue()))
             {
                 includeRecordFolders = true;
@@ -221,6 +222,7 @@ public class SearchTypesFactory
                 if (nodeTypeQNameStr.equals(RecordsManagementModel.TYPE_RECORD_FOLDER))
                 {
                     includeRecordFolders = true;
+
                 }
                 else if (filterNodeTypeQName.equals(RecordsManagementModel.TYPE_RECORD_CATEGORY))
                 {
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RMNode.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RMNode.java
index d4d590e3e8..7ddc40ded9 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RMNode.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RMNode.java
@@ -57,6 +57,7 @@ public abstract class RMNode
     public static final String PARAM_PROPERTIES = "properties";
     public static final String PARAM_PATH = "path";
     public static final String PARAM_ALLOWABLE_OPERATIONS = "allowableOperations";
+    public static final String PARAM_AUTO_RENAME = "autoRename";
     
     public static final String PARAM_ISPRIMARY = "isPrimary";
     
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UploadInfo.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UploadInfo.java
index bca3e81c29..376d9cc238 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UploadInfo.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UploadInfo.java
@@ -26,6 +26,7 @@
  */
 package org.alfresco.rm.rest.api.model;
 
+import java.util.HashMap;
 import java.util.Map;
 
 import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
@@ -50,6 +51,8 @@ public class UploadInfo
 
     public UploadInfo(FormData formData)
     {
+        properties = new HashMap<>();
+
         for (FormData.FormField field : formData.getFields())
         {
             switch (field.getName().toLowerCase())
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/RecordCategoriesEntityResource.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/RecordCategoriesEntityResource.java
index 5ab0005162..27f9cfde29 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/RecordCategoriesEntityResource.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/RecordCategoriesEntityResource.java
@@ -130,7 +130,15 @@ public class RecordCategoriesEntityResource implements
         };
         transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
 
-        FileInfo info = fileFolderService.getFileInfo(nodeRef);
+        RetryingTransactionCallback readCallback = new RetryingTransactionCallback()
+        {
+            public FileInfo execute()
+            {
+                return fileFolderService.getFileInfo(nodeRef);
+            }
+        };
+        FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true);
+        
         return nodesModelFactory.createRecordCategory(info, parameters, null, false);
     }
 
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/RecordCategoryChildrenRelation.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/RecordCategoryChildrenRelation.java
index 8da2cbf427..4560daa3cb 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/RecordCategoryChildrenRelation.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/RecordCategoryChildrenRelation.java
@@ -33,6 +33,7 @@ import static org.alfresco.util.ParameterCheck.mandatory;
 import java.util.AbstractList;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedList;
@@ -40,18 +41,22 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.alfresco.model.ContentModel;
 import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
 import org.alfresco.query.PagingResults;
 import org.alfresco.repo.node.getchildren.FilterProp;
+import org.alfresco.repo.node.integrity.IntegrityException;
 import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
 import org.alfresco.rest.api.Nodes;
 import org.alfresco.rest.api.impl.Util;
 import org.alfresco.rest.api.model.UserInfo;
 import org.alfresco.rest.framework.WebApiDescription;
 import org.alfresco.rest.framework.resource.RelationshipResource;
+import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction;
 import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
 import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
 import org.alfresco.rest.framework.resource.parameters.Parameters;
+import org.alfresco.rest.framework.webscripts.WithResponse;
 import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory;
 import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils;
 import org.alfresco.rm.rest.api.impl.SearchTypesFactory;
@@ -64,6 +69,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
 import org.alfresco.service.namespace.QName;
 import org.alfresco.service.transaction.TransactionService;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.extensions.webscripts.servlet.FormData;
 
 /**
  * Record category children relation
@@ -74,7 +80,8 @@ import org.apache.commons.lang3.StringUtils;
  */
 @RelationshipResource(name="children", entityResource = RecordCategoriesEntityResource.class, title = "Children of a record category")
 public class RecordCategoryChildrenRelation implements RelationshipResourceAction.Read,
-                                                 RelationshipResourceAction.Create
+                                                    RelationshipResourceAction.Create,
+                                                    MultiPartRelationshipResourceAction.Create
 {
     private final static Set LIST_RECORD_CATEGORY_CHILDREN_EQUALS_QUERY_PROPERTIES = new HashSet<>(Arrays
             .asList(new String[] { RecordCategoryChild.PARAM_IS_RECORD_CATEGORY, RecordCategoryChild.PARAM_IS_RECORD_FOLDER,
@@ -123,10 +130,11 @@ public class RecordCategoryChildrenRelation implements RelationshipResourceActio
 
         // list record categories and record folders
         Set searchTypeQNames = searchTypesFactory.buildSearchTypesCategoriesEndpoint(parameters, LIST_RECORD_CATEGORY_CHILDREN_EQUALS_QUERY_PROPERTIES);
+        Set assocTypeQNames = Collections.singleton(ContentModel.ASSOC_CONTAINS);
         List filterProps = apiUtils.getListChildrenFilterProps(parameters, LIST_RECORD_CATEGORY_CHILDREN_EQUALS_QUERY_PROPERTIES);
 
         final PagingResults pagingResults = fileFolderService.list(parentNodeRef,
-                null,
+                assocTypeQNames,
                 searchTypeQNames,
                 null,
                 apiUtils.getSortProperties(parameters),
@@ -189,8 +197,7 @@ public class RecordCategoryChildrenRelation implements RelationshipResourceActio
                                 RecordsManagementModel.TYPE_RECORD_CATEGORY);
                     }
                     // Create the node
-                    NodeRef newNode = apiUtils.createRMNode(nodeParent, nodeInfo.getName(), nodeInfo.getNodeType(),
-                            nodeInfo.getProperties(), nodeInfo.getAspectNames());
+                    NodeRef newNode =  apiUtils.createRMNode(nodeParent, nodeInfo, parameters);
                     createdNodes.add(newNode);
                 }
                 return createdNodes;
@@ -206,4 +213,10 @@ public class RecordCategoryChildrenRelation implements RelationshipResourceActio
 
         return result;
     }
+
+    @Override
+    public RecordCategoryChild create(String entityResourceId, FormData formData, Parameters parameters, WithResponse withResponse)
+    {
+        throw new IntegrityException("Uploading records into record categories is not allowed.", null);
+    }
 }
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/RecordFolderChildrenRelation.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/RecordFolderChildrenRelation.java
index 84a6b1f84a..1b4fd75877 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/RecordFolderChildrenRelation.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/RecordFolderChildrenRelation.java
@@ -167,7 +167,7 @@ public class RecordFolderChildrenRelation implements RelationshipResourceAction.
                 List createdNodes = new LinkedList<>();
                 for (Record nodeInfo : nodeInfos)
                 {
-                    NodeRef newNodeRef = apiUtils.createRMNode(parentNodeRef, nodeInfo.getName(), nodeInfo.getNodeType(), nodeInfo.getProperties(), nodeInfo.getAspectNames());
+                    NodeRef newNodeRef = apiUtils.createRMNode(parentNodeRef, nodeInfo, parameters);
                     createdNodes.add(newNodeRef);
                 }
                 return createdNodes;
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/RecordFolderEntityResource.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/RecordFolderEntityResource.java
index 6b88373e6f..a97ca9df44 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/RecordFolderEntityResource.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/RecordFolderEntityResource.java
@@ -125,7 +125,15 @@ public class RecordFolderEntityResource implements EntityResourceAction.ReadById
         };
         transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
 
-        FileInfo info = fileFolderService.getFileInfo(nodeRef);
+        RetryingTransactionCallback readCallback = new RetryingTransactionCallback()
+        {
+            public FileInfo execute()
+            {
+                return fileFolderService.getFileInfo(nodeRef);
+            }
+        };
+        FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true);
+
         return nodesModelFactory.createRecordFolder(info, parameters, null, false);
     }
 
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/records/RecordsEntityResource.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/records/RecordsEntityResource.java
index 78dc66df5d..4aef34e7d0 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/records/RecordsEntityResource.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/records/RecordsEntityResource.java
@@ -217,7 +217,15 @@ public class RecordsEntityResource implements BinaryResourceAction.Read,
         transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
 
         // return record state
-        FileInfo info = fileFolderService.getFileInfo(record);
+        RetryingTransactionCallback readCallback = new RetryingTransactionCallback()
+        {
+            public FileInfo execute()
+            {
+                return fileFolderService.getFileInfo(record);
+            }
+        };
+        FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true);
+        
         apiUtils.postActivity(info, recordInfo.getParentId(), ActivityType.FILE_UPDATED);
         return nodesModelFactory.createRecord(info, parameters, null, false);
     }
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfercontainers/TransferContainerEntityResource.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfercontainers/TransferContainerEntityResource.java
index 129245007b..f2f7df6cfb 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfercontainers/TransferContainerEntityResource.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfercontainers/TransferContainerEntityResource.java
@@ -128,7 +128,15 @@ public class TransferContainerEntityResource implements
         };
         transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
 
-        FileInfo info = fileFolderService.getFileInfo(nodeRef);
+        RetryingTransactionCallback readCallback = new RetryingTransactionCallback()
+        {
+            public FileInfo execute()
+            {
+                return fileFolderService.getFileInfo(nodeRef);
+            }
+        };
+        FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true);
+
         return nodesModelFactory.createTransferContainer(info, parameters, null, false);
     }
 }
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/UnfiledContainerChildrenRelation.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/UnfiledContainerChildrenRelation.java
index 7e73f0fcd3..0408de262a 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/UnfiledContainerChildrenRelation.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/UnfiledContainerChildrenRelation.java
@@ -186,7 +186,7 @@ public class UnfiledContainerChildrenRelation implements RelationshipResourceAct
                 List createdNodes = new LinkedList<>();
                 for (UnfiledContainerChild nodeInfo : nodeInfos)
                 {
-                    NodeRef newNodeRef = apiUtils.createRMNode(parentNodeRef, nodeInfo.getName(), nodeInfo.getNodeType(), nodeInfo.getProperties(), nodeInfo.getAspectNames());
+                    NodeRef newNodeRef = apiUtils.createRMNode(parentNodeRef, nodeInfo, parameters);
                     createdNodes.add(newNodeRef);
                 }
                 return createdNodes;
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/UnfiledContainerEntityResource.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/UnfiledContainerEntityResource.java
index 551b288a2c..3896a882a3 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/UnfiledContainerEntityResource.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/UnfiledContainerEntityResource.java
@@ -126,7 +126,15 @@ public class UnfiledContainerEntityResource
         };
         transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
 
-        FileInfo info = fileFolderService.getFileInfo(nodeRef);
+        RetryingTransactionCallback readCallback = new RetryingTransactionCallback()
+        {
+            public FileInfo execute()
+            {
+                return fileFolderService.getFileInfo(nodeRef);
+            }
+        };
+        FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true);
+
         apiUtils.postActivity(info, unfiledContainerInfo.getParentId(), ActivityType.FILE_UPDATED);
         return nodesModelFactory.createUnfiledContainer(info, parameters, null, false);
     }
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/UnfiledRecordFolderChildrenRelation.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/UnfiledRecordFolderChildrenRelation.java
index ec18fc0e25..9fff8274af 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/UnfiledRecordFolderChildrenRelation.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/UnfiledRecordFolderChildrenRelation.java
@@ -174,7 +174,7 @@ public class UnfiledRecordFolderChildrenRelation implements RelationshipResource
         mandatory("parameters", parameters);
 
         NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(unfiledRecordFolderId, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER);
-
+        
         // Create the children
         RetryingTransactionCallback> callback = new RetryingTransactionCallback>()
         {
@@ -193,7 +193,7 @@ public class UnfiledRecordFolderChildrenRelation implements RelationshipResource
                         nodeParent = parentNodeRef;
                     }
 
-                    NodeRef newNodeRef = apiUtils.createRMNode(nodeParent, nodeInfo.getName(), nodeInfo.getNodeType(), nodeInfo.getProperties(), nodeInfo.getAspectNames());
+                    NodeRef newNodeRef = apiUtils.createRMNode(nodeParent, nodeInfo, parameters);
                     createdNodes.add(newNodeRef);
                 }
                 return createdNodes;
diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/UnfiledRecordFolderEntityResource.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/UnfiledRecordFolderEntityResource.java
index 651c46ba34..c4aa9a8db2 100644
--- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/UnfiledRecordFolderEntityResource.java
+++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/UnfiledRecordFolderEntityResource.java
@@ -130,7 +130,15 @@ public class UnfiledRecordFolderEntityResource implements EntityResourceAction.R
         };
         transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
 
-        FileInfo info = fileFolderService.getFileInfo(nodeRef);
+        RetryingTransactionCallback readCallback = new RetryingTransactionCallback()
+        {
+            public FileInfo execute()
+            {
+                return fileFolderService.getFileInfo(nodeRef);
+            }
+        };
+        FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true);
+
         apiUtils.postActivity(info, unfiledRecordFolderInfo.getParentId(), ActivityType.FILE_UPDATED);
         return nodesModelFactory.createUnfiledRecordFolder(info, parameters, null, false);
     }