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 a508de854b..f02b88b7a8 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 @@ -31,6 +31,7 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IS_CLOSED; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_LOCATION; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_REVIEW_PERIOD; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF; @@ -40,6 +41,7 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonSerialize; +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; @@ -99,4 +101,7 @@ public class RecordCategoryChildProperties extends TestModel @JsonProperty (PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE) private Boolean recordSearchHasDispositionSchedule; + + @JsonProperty (PROPERTIES_OWNER) + private Owner owner; } \ No newline at end of file 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 085644eb6b..a7ab94c039 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 @@ -60,4 +60,7 @@ public class UnfiledContainerProperties extends TestModel /*************************/ @JsonProperty (required = true, value = PROPERTIES_IDENTIFIER) private String identifier; + + @JsonProperty (required = true, value = PROPERTIES_ROOT_NODE_REF) + private String rootNodeRef; } 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 73b1780b84..eba2d7e853 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 @@ -241,10 +241,10 @@ public class FilePlanTests extends BaseRMRestTest assertStatusCode(OK); // Verify the returned description field for the file plan component - assertEquals(renamedFilePlan.getProperties().getDescription(), FILE_PLAN_DESCRIPTION); + assertEquals(FILE_PLAN_DESCRIPTION, renamedFilePlan.getProperties().getDescription()); // Verify the returned title field for the file plan component - assertEquals(renamedFilePlan.getProperties().getTitle(), FILE_PLAN_TITLE); + assertEquals(FILE_PLAN_TITLE, renamedFilePlan.getProperties().getTitle()); } /** diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/ElectronicRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/ElectronicRecordTests.java index f226c946b2..fcb34ae859 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/ElectronicRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/ElectronicRecordTests.java @@ -349,9 +349,6 @@ public class ElectronicRecordTests extends BaseRMRestTest UnfiledContainerChild unfiledContainerChildModel= UnfiledContainerChild.builder() .name(ELECTRONIC_RECORD_NAME) .nodeType(CONTENT_TYPE) - .content(RecordContent.builder() - .mimeType(TEXT_PLAIN_VALUE) - .build()) .relativePath(relativePath) .build(); 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 8871e57269..5593a55a2a 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 @@ -126,7 +126,7 @@ public class FilePlanEntityResource } NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(filePlanId, filePlanType); - RetryingTransactionCallback callback = new RetryingTransactionCallback() + RetryingTransactionCallback updateCallback = new RetryingTransactionCallback() { public Void execute() { @@ -134,9 +134,17 @@ public class FilePlanEntityResource return null; } }; - transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); + transactionService.getRetryingTransactionHelper().doInTransaction(updateCallback, false, true); + + RetryingTransactionCallback readCallback = new RetryingTransactionCallback() + { + public FileInfo execute() + { + return fileFolderService.getFileInfo(nodeRef); + } + }; + FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true); - FileInfo info = fileFolderService.getFileInfo(nodeRef); return nodesModelFactory.createFilePlan(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 b9c968c5a5..ec18fc0e25 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 @@ -67,6 +67,7 @@ import org.alfresco.service.cmr.model.FileInfo; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName; import org.alfresco.service.transaction.TransactionService; +import org.alfresco.util.Pair; import org.apache.commons.lang3.StringUtils; import org.springframework.extensions.webscripts.servlet.FormData; @@ -224,21 +225,25 @@ public class UnfiledRecordFolderChildrenRelation implements RelationshipResource // Retrieve the input data and resolve the parent node final UploadInfo uploadInfo = new UploadInfo(formData); - final NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(unfiledRecordFolderId, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER, uploadInfo.getRelativePath()); - // Create the record - RetryingTransactionCallback callback = new RetryingTransactionCallback() + // Create the record - returns pair(newNode,parentNode) + RetryingTransactionCallback> callback = new RetryingTransactionCallback>() { - public NodeRef execute() + public Pair execute() { - return apiUtils.uploadRecord(parentNodeRef, uploadInfo.getFileName(), uploadInfo.getNodeType(), uploadInfo.getProperties(), uploadInfo.getContent().getInputStream()); + final NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(unfiledRecordFolderId, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER, uploadInfo.getRelativePath()); + NodeRef newNode = apiUtils.uploadRecord(parentNodeRef, uploadInfo.getFileName(), uploadInfo.getNodeType(), uploadInfo.getProperties(), uploadInfo.getContent().getInputStream()); + return new Pair(newNode, parentNodeRef); } }; - NodeRef newNode = transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); + Pair nodeAndParentInfo = transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); + NodeRef newNode = nodeAndParentInfo.getFirst(); + NodeRef parent = nodeAndParentInfo.getSecond(); - // Get file info for response + // Get file info for response FileInfo info = fileFolderService.getFileInfo(newNode); - apiUtils.postActivity(info, parentNodeRef, ActivityType.FILE_ADDED); + apiUtils.postActivity(info, parent, ActivityType.FILE_ADDED); + return nodesModelFactory.createUnfiledRecordFolderChild(info, parameters, null, false); } }