mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge 'master' into feature/RM-5012_recordIdentifier
This commit is contained in:
12
README.txt
12
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
|
- http://docs.alfresco.com/outlook2.1/tasks/Outlook-install_v2.html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SNAPSHOT dependencies:
|
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.
|
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:
|
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]
|
[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
|
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.
|
||||||
|
@@ -47,6 +47,7 @@ public class FilePlanComponentFields
|
|||||||
public static final String PROPERTIES_VITAL_RECORD_INDICATOR = "rma:vitalRecordIndicator";
|
public static final String PROPERTIES_VITAL_RECORD_INDICATOR = "rma:vitalRecordIndicator";
|
||||||
public static final String PROPERTIES_REVIEW_PERIOD = "rma:reviewPeriod";
|
public static final String PROPERTIES_REVIEW_PERIOD = "rma:reviewPeriod";
|
||||||
public static final String PROPERTIES_OWNER = "cm:owner";
|
public static final String PROPERTIES_OWNER = "cm:owner";
|
||||||
|
public static final String PROPERTIES_AUTHOR="cm:author";
|
||||||
|
|
||||||
/** Common properties for record folders and records */
|
/** Common properties for record folders and records */
|
||||||
public static final String PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE = "rma:recordSearchHasDispositionSchedule";
|
public static final String PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE = "rma:recordSearchHasDispositionSchedule";
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
package org.alfresco.rest.rm.community.model.record;
|
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_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_FILED;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DATE_TIME_ORIGINAL;
|
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_USER_ID;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_CREATION_DATE;
|
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 com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import org.alfresco.rest.rm.community.model.common.Owner;
|
import org.alfresco.rest.rm.community.model.common.Owner;
|
||||||
@@ -84,6 +86,7 @@ import lombok.NoArgsConstructor;
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class RecordProperties extends TestModel
|
public class RecordProperties extends TestModel
|
||||||
{
|
{
|
||||||
/*************************/
|
/*************************/
|
||||||
@@ -196,4 +199,7 @@ public class RecordProperties extends TestModel
|
|||||||
|
|
||||||
@JsonProperty (PROPERTIES_OWNER)
|
@JsonProperty (PROPERTIES_OWNER)
|
||||||
private Owner owner;
|
private Owner owner;
|
||||||
|
|
||||||
|
@JsonProperty(PROPERTIES_AUTHOR)
|
||||||
|
private String author;
|
||||||
}
|
}
|
||||||
|
@@ -130,7 +130,7 @@ public class RecordCategoryChildProperties extends TestModel
|
|||||||
private Boolean recordSearchDispositionEventsEligible;
|
private Boolean recordSearchDispositionEventsEligible;
|
||||||
|
|
||||||
@JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS)
|
@JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS)
|
||||||
private String recordSearchDispositionInstructions;
|
private String recordSearchDispositionInstructions;
|
||||||
|
|
||||||
@JsonProperty (PROPERTIES_OWNER)
|
@JsonProperty (PROPERTIES_OWNER)
|
||||||
private Owner owner;
|
private Owner owner;
|
||||||
|
@@ -29,12 +29,11 @@ package org.alfresco.rest.rm.community.model.transfer;
|
|||||||
|
|
||||||
import java.util.List;
|
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 com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import org.alfresco.rest.model.RestByUserModel;
|
||||||
|
import org.alfresco.utility.model.TestModel;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@@ -29,12 +29,11 @@ package org.alfresco.rest.rm.community.model.transfercontainer;
|
|||||||
|
|
||||||
import java.util.List;
|
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 com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import org.alfresco.rest.model.RestByUserModel;
|
||||||
|
import org.alfresco.utility.model.TestModel;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@@ -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_X_RESOLUTION;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_Y_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 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.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@@ -27,15 +27,12 @@
|
|||||||
package org.alfresco.rest.rm.community.model.unfiledcontainer;
|
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_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_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 com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import org.alfresco.utility.model.TestModel;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@@ -41,19 +41,18 @@ import static org.testng.Assert.fail;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Iterator;
|
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.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||||
import com.jayway.restassured.http.ContentType;
|
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
|
* Unfiled Container REST API Wrapper
|
||||||
*
|
*
|
||||||
@@ -209,7 +208,7 @@ public class UnfiledContainerAPI extends RMModelRequest
|
|||||||
* to the request.
|
* to the request.
|
||||||
*/
|
*/
|
||||||
RequestSpecBuilder builder = getRmRestWrapper().configureRequestSpec();
|
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
|
// add request fields
|
||||||
Iterator<String> fieldNames = root.fieldNames();
|
Iterator<String> fieldNames = root.fieldNames();
|
||||||
while (fieldNames.hasNext())
|
while (fieldNames.hasNext())
|
||||||
|
@@ -42,19 +42,18 @@ import static org.testng.Assert.fail;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Iterator;
|
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.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.jayway.restassured.builder.RequestSpecBuilder;
|
import com.jayway.restassured.builder.RequestSpecBuilder;
|
||||||
import com.jayway.restassured.http.ContentType;
|
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
|
* Unfiled Record Folders REST API Wrapper
|
||||||
*
|
*
|
||||||
@@ -209,7 +208,7 @@ public class UnfiledRecordFolderAPI extends RMModelRequest
|
|||||||
* to the request.
|
* to the request.
|
||||||
*/
|
*/
|
||||||
RequestSpecBuilder builder = getRmRestWrapper().configureRequestSpec();
|
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
|
// add request fields
|
||||||
Iterator<String> fieldNames = root.fieldNames();
|
Iterator<String> fieldNames = root.fieldNames();
|
||||||
while (fieldNames.hasNext())
|
while (fieldNames.hasNext())
|
||||||
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
* #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();
|
||||||
|
}
|
@@ -54,7 +54,6 @@ import org.json.JSONObject;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,8 +76,6 @@ public class RMRolesAndActionsAPI extends BaseAPI
|
|||||||
@Autowired
|
@Autowired
|
||||||
private AlfrescoHttpClientFactory alfrescoHttpClientFactory;
|
private AlfrescoHttpClientFactory alfrescoHttpClientFactory;
|
||||||
|
|
||||||
private ApplicationContext applicationContext;
|
|
||||||
|
|
||||||
/** user service */
|
/** user service */
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
@@ -28,6 +28,7 @@ package org.alfresco.rest.rm.community.base;
|
|||||||
|
|
||||||
import static lombok.AccessLevel.PROTECTED;
|
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.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.FILE_PLAN_ALIAS;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_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_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_FOLDER_TYPE;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_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_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.createRecordCategoryChildModel;
|
||||||
import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createRecordCategoryModel;
|
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.FilePlanComponentsUtil.createUnfiledContainerChildModel;
|
||||||
import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createStandardRMSiteModel;
|
import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createStandardRMSiteModel;
|
||||||
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
|
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.RestTest;
|
||||||
import org.alfresco.rest.core.RestAPIFactory;
|
import org.alfresco.rest.core.RestAPIFactory;
|
||||||
import org.alfresco.rest.rm.community.model.fileplan.FilePlan;
|
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.record.Record;
|
||||||
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
|
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
|
||||||
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
|
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
|
public UnfiledContainerChild createUnfiledContainerChild(UserModel user, String parentId, String childName, String nodeType) throws Exception
|
||||||
{
|
{
|
||||||
|
UnfiledContainerChild child = null;
|
||||||
UnfiledContainerChild childModel = createUnfiledContainerChildModel(childName, nodeType);
|
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);
|
assertStatusCode(CREATED);
|
||||||
|
|
||||||
return child;
|
return child;
|
||||||
|
@@ -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
|
* 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_CATEGORY_TYPE },
|
||||||
{ RECORD_FOLDER_TYPE },
|
{ RECORD_FOLDER_TYPE },
|
||||||
{ TRANSFER_CONTAINER_TYPE },
|
{ TRANSFER_CONTAINER_TYPE },
|
||||||
{ UNFILED_CONTAINER_TYPE }
|
{ TRANSFER_TYPE },
|
||||||
|
{ UNFILED_CONTAINER_TYPE },
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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.UserPermissions.PERMISSION_FILING;
|
||||||
import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER;
|
import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER;
|
||||||
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
|
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.CREATED;
|
||||||
import static org.springframework.http.HttpStatus.FORBIDDEN;
|
import static org.springframework.http.HttpStatus.FORBIDDEN;
|
||||||
import static org.springframework.http.HttpStatus.NOT_FOUND;
|
import static org.springframework.http.HttpStatus.NOT_FOUND;
|
||||||
import static org.springframework.http.HttpStatus.OK;
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
|
import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
|
||||||
import static org.testng.Assert.assertFalse;
|
import static org.testng.Assert.assertFalse;
|
||||||
|
import static org.testng.Assert.assertNotEquals;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
import static org.testng.Assert.fail;
|
import static org.testng.Assert.fail;
|
||||||
@@ -322,6 +324,56 @@ public class FilePlanTests extends BaseRMRestTest
|
|||||||
assertNotNull(rootRecordCategoryProperties.getIdentifier());
|
assertNotNull(rootRecordCategoryProperties.getIdentifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* 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
|
||||||
|
*</pre>
|
||||||
|
* <pre>
|
||||||
|
* 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
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
@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
|
@Test
|
||||||
public void listFilePlanChildren() throws Exception
|
public void listFilePlanChildren() throws Exception
|
||||||
{
|
{
|
||||||
|
@@ -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.RECORD_FOLDER_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_RECORD_FOLDER_TYPE;
|
||||||
import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.TITLE_PREFIX;
|
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.alfresco.utility.data.RandomData.getRandomAlphanumeric;
|
||||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
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.CREATED;
|
||||||
import static org.springframework.http.HttpStatus.NOT_FOUND;
|
import static org.springframework.http.HttpStatus.NOT_FOUND;
|
||||||
import static org.springframework.http.HttpStatus.NO_CONTENT;
|
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.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertFalse;
|
import static org.testng.Assert.assertFalse;
|
||||||
|
import static org.testng.Assert.assertNotEquals;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
import static org.testng.Assert.fail;
|
import static org.testng.Assert.fail;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.NoSuchElementException;
|
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.FilePlanAPI;
|
||||||
import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI;
|
import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI;
|
||||||
import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
|
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.alfresco.utility.report.Bug;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.testng.annotations.Test;
|
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_CHILDREN = 10;
|
||||||
private static final int NUMBER_OF_FOLDERS = 5;
|
private static final int NUMBER_OF_FOLDERS = 5;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RecordCategoriesAPI recordCategoriesAPI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invalid containers that cannot be deleted with record category end-point
|
* 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);
|
assertEquals(folderProperties.getTitle(), TITLE_PREFIX + RECORD_FOLDER_NAME);
|
||||||
assertNotNull(folderProperties.getIdentifier());
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* Given that a record category exists
|
* 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
|
* 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
|
* Then I am returned the contained record categories and record folders and their details
|
||||||
* </pre>
|
* </pre>
|
||||||
|
* <pre>
|
||||||
|
* 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
|
||||||
|
* </pre>
|
||||||
*/
|
*/
|
||||||
@Test
|
@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
|
public void getRecordCategoryChildren() throws Exception
|
||||||
{
|
{
|
||||||
// Create root level category
|
// Create root level category
|
||||||
RecordCategory rootRecordCategory = createRootCategory(getRandomAlphanumeric());
|
RecordCategory rootRecordCategory = createRootCategory(getRandomAlphanumeric());
|
||||||
assertNotNull(rootRecordCategory.getId());
|
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<RETENTION_SCHEDULE, String> 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
|
// Add record category children
|
||||||
List<RecordCategoryChild> children = new ArrayList<RecordCategoryChild>();
|
List<RecordCategoryChild> children = new ArrayList<RecordCategoryChild>();
|
||||||
for (int i=0; i < NUMBER_OF_CHILDREN; i++)
|
for (int i=0; i < NUMBER_OF_CHILDREN; i++)
|
||||||
|
@@ -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.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.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.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.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_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_FOLDER_TYPE;
|
||||||
@@ -105,7 +106,8 @@ public class RecordFolderTests extends BaseRMRestTest
|
|||||||
{ UNFILED_CONTAINER_TYPE },
|
{ UNFILED_CONTAINER_TYPE },
|
||||||
{ UNFILED_RECORD_FOLDER_TYPE },
|
{ UNFILED_RECORD_FOLDER_TYPE },
|
||||||
{ TRANSFER_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
|
// Make a request to close the record folder
|
||||||
RecordFolder updatedRecordFolder = recordFolderAPI.updateRecordFolder(recordFolderModel, recordFolder.getId());
|
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
|
// Verify that the record folder is closed now
|
||||||
assertTrue(updatedRecordFolder.getProperties().getIsClosed());
|
assertTrue(updatedRecordFolder.getProperties().getIsClosed());
|
||||||
|
|
||||||
@@ -386,9 +385,6 @@ public class RecordFolderTests extends BaseRMRestTest
|
|||||||
// Make a request to reopen the record folder
|
// Make a request to reopen the record folder
|
||||||
updatedRecordFolder = recordFolderAPI.updateRecordFolder(recordFolderModel, recordFolder.getId());
|
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
|
// Verify that the record folder is open now
|
||||||
assertFalse(updatedRecordFolder.getProperties().getIsClosed());
|
assertFalse(updatedRecordFolder.getProperties().getIsClosed());
|
||||||
}
|
}
|
||||||
|
@@ -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.rest.rm.community.utils.FilePlanComponentsUtil.createUnfiledContainerChildModel;
|
||||||
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
|
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
|
||||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
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.OK;
|
||||||
import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
|
import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertFalse;
|
import static org.testng.Assert.assertFalse;
|
||||||
|
import static org.testng.Assert.assertNotEquals;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import static org.testng.Assert.assertTrue;
|
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.requests.gscore.api.UnfiledContainerAPI;
|
||||||
import org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil;
|
import org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.alfresco.utility.report.Bug;
|
||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.AfterMethod;
|
import org.testng.annotations.AfterMethod;
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
@@ -165,7 +169,7 @@ public class UnfiledContainerTests extends BaseRMRestTest
|
|||||||
public void createUnfiledRecordFolderChild(String folderType) throws Exception
|
public void createUnfiledRecordFolderChild(String folderType) throws Exception
|
||||||
{
|
{
|
||||||
String unfiledRecordFolderName = "UnfiledRecordFolder-" + getRandomAlphanumeric();
|
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());
|
assertNotNull(unfiledRecordFolderChild.getId());
|
||||||
|
|
||||||
@@ -187,6 +191,39 @@ public class UnfiledContainerTests extends BaseRMRestTest
|
|||||||
getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId());
|
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));
|
||||||
|
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* Given that an unfiled records container exists
|
* Given that an unfiled records container exists
|
||||||
@@ -396,7 +433,8 @@ public class UnfiledContainerTests extends BaseRMRestTest
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
getRestAPIFactory().getUnfiledContainersAPI().createUnfiledContainerChild(unfiledFolderModel, UNFILED_RECORDS_CONTAINER_ALIAS);
|
getRestAPIFactory().getUnfiledContainersAPI().createUnfiledContainerChild(unfiledFolderModel, UNFILED_RECORDS_CONTAINER_ALIAS);
|
||||||
} catch (Exception error)
|
}
|
||||||
|
catch (Exception error)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
// Verify the status code
|
// Verify the status code
|
||||||
|
@@ -487,8 +487,10 @@ public class UnfiledRecordsFolderTests extends BaseRMRestTest
|
|||||||
assertTrue(record.getName().equals(createdComponent.getName()),
|
assertTrue(record.getName().equals(createdComponent.getName()),
|
||||||
"The record name "+ record.getName()+" is not equal with the record name returned when creating the record " + createdComponent
|
"The record name "+ record.getName()+" is not equal with the record name returned when creating the record " + createdComponent
|
||||||
.getName());
|
.getName());
|
||||||
|
String identifier = " \\(" + record.getProperties().getIdentifier() + "\\)";
|
||||||
assertTrue(record.getName().contains(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()));
|
assertTrue(createdComponent.getName().contains(createdComponent.getProperties().getIdentifier()));
|
||||||
assertEquals(createdComponent.getNodeType(), record.getNodeType());
|
assertEquals(createdComponent.getNodeType(), record.getNodeType());
|
||||||
|
|
||||||
|
@@ -39,22 +39,23 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.alfresco.query.PagingResults;
|
import org.alfresco.query.PagingResults;
|
||||||
import org.alfresco.repo.activities.ActivityType;
|
|
||||||
import org.alfresco.repo.node.getchildren.FilterProp;
|
import org.alfresco.repo.node.getchildren.FilterProp;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.rest.api.impl.Util;
|
import org.alfresco.rest.api.impl.Util;
|
||||||
import org.alfresco.rest.api.model.UserInfo;
|
import org.alfresco.rest.api.model.UserInfo;
|
||||||
import org.alfresco.rest.framework.WebApiDescription;
|
import org.alfresco.rest.framework.WebApiDescription;
|
||||||
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
||||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
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.actions.interfaces.RelationshipResourceAction;
|
||||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
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.ApiNodesModelFactory;
|
||||||
import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils;
|
import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils;
|
||||||
import org.alfresco.rm.rest.api.impl.SearchTypesFactory;
|
import org.alfresco.rm.rest.api.impl.SearchTypesFactory;
|
||||||
import org.alfresco.rm.rest.api.model.FilePlan;
|
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.rm.rest.api.model.RecordCategory;
|
||||||
import org.alfresco.service.cmr.model.FileFolderService;
|
import org.alfresco.service.cmr.model.FileFolderService;
|
||||||
import org.alfresco.service.cmr.model.FileInfo;
|
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.service.transaction.TransactionService;
|
||||||
import org.alfresco.util.ParameterCheck;
|
import org.alfresco.util.ParameterCheck;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
import org.springframework.extensions.webscripts.servlet.FormData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File plan children relation
|
* 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")
|
@RelationshipResource(name="categories", entityResource = FilePlanEntityResource.class, title = "Category children of file plan")
|
||||||
public class FilePlanChildrenRelation implements RelationshipResourceAction.Read<RecordCategory>,
|
public class FilePlanChildrenRelation implements RelationshipResourceAction.Read<RecordCategory>,
|
||||||
RelationshipResourceAction.Create<RecordCategory>, InitializingBean
|
RelationshipResourceAction.Create<RecordCategory>,
|
||||||
|
MultiPartRelationshipResourceAction.Create<RecordCategory>,
|
||||||
|
InitializingBean
|
||||||
{
|
{
|
||||||
/** Record category type */
|
/** Record category type */
|
||||||
public static final String RECORD_CATEGORY_TYPE = "rma:recordCategory";
|
public static final String RECORD_CATEGORY_TYPE = "rma:recordCategory";
|
||||||
@@ -198,8 +202,8 @@ public class FilePlanChildrenRelation implements RelationshipResourceAction.Read
|
|||||||
for (RecordCategory nodeInfo : nodeInfos)
|
for (RecordCategory nodeInfo : nodeInfos)
|
||||||
{
|
{
|
||||||
// Create the node
|
// Create the node
|
||||||
NodeRef newNodeRef = apiUtils.createRMNode(parentNodeRef, nodeInfo.getName(), RECORD_CATEGORY_TYPE,
|
nodeInfo.setNodeType(RECORD_CATEGORY_TYPE);
|
||||||
nodeInfo.getProperties(), nodeInfo.getAspectNames());
|
NodeRef newNodeRef = apiUtils.createRMNode(parentNodeRef, nodeInfo, parameters);
|
||||||
createdNodes.add(newNodeRef);
|
createdNodes.add(newNodeRef);
|
||||||
}
|
}
|
||||||
return createdNodes;
|
return createdNodes;
|
||||||
@@ -218,4 +222,13 @@ public class FilePlanChildrenRelation implements RelationshipResourceAction.Read
|
|||||||
|
|
||||||
return result;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -55,8 +55,9 @@ import org.springframework.beans.factory.InitializingBean;
|
|||||||
* @since 2.6
|
* @since 2.6
|
||||||
*/
|
*/
|
||||||
@EntityResource(name = "file-plans", title = "File plans")
|
@EntityResource(name = "file-plans", title = "File plans")
|
||||||
public class FilePlanEntityResource
|
public class FilePlanEntityResource implements EntityResourceAction.ReadById<FilePlan>,
|
||||||
implements EntityResourceAction.ReadById<FilePlan>, EntityResourceAction.Update<FilePlan>, InitializingBean
|
EntityResourceAction.Update<FilePlan>,
|
||||||
|
InitializingBean
|
||||||
{
|
{
|
||||||
|
|
||||||
private FilePlanComponentsApiUtils apiUtils;
|
private FilePlanComponentsApiUtils apiUtils;
|
||||||
|
@@ -136,6 +136,12 @@ public class FilePlanComponentsApiUtils
|
|||||||
RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER,
|
RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER,
|
||||||
RecordsManagementModel.TYPE_HOLD_CONTAINER);
|
RecordsManagementModel.TYPE_HOLD_CONTAINER);
|
||||||
|
|
||||||
|
public static final List<QName> 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 */
|
/** RM Nodes API */
|
||||||
private Nodes nodes;
|
private Nodes nodes;
|
||||||
private FileFolderService fileFolderService;
|
private FileFolderService fileFolderService;
|
||||||
@@ -600,27 +606,43 @@ public class FilePlanComponentsApiUtils
|
|||||||
* Create an RM node
|
* Create an RM node
|
||||||
*
|
*
|
||||||
* @param parentNodeRef the parent of the node
|
* @param parentNodeRef the parent of the node
|
||||||
* @param name the name of the new node
|
* @param nodeInfo the node infos to create
|
||||||
* @param type the type of the node
|
* @param parameters the object to get the parameters passed into the request
|
||||||
* @param properties properties to set on the new node
|
|
||||||
* @param aspects aspects to set on the new node
|
|
||||||
* @return the new node
|
* @return the new node
|
||||||
*/
|
*/
|
||||||
public NodeRef createRMNode(NodeRef parentNodeRef, String name, String type, Map<String, Object> properties, List<String> aspects)
|
public NodeRef createRMNode(NodeRef parentNodeRef, RMNode nodeInfo, Parameters parameters)
|
||||||
{
|
{
|
||||||
mandatory("parentNodeRef", parentNodeRef);
|
mandatory("parentNodeRef", parentNodeRef);
|
||||||
checkNotBlank(RMNode.PARAM_NAME, name);
|
mandatory("nodeInfo", nodeInfo);
|
||||||
checkNotBlank(RMNode.PARAM_NODE_TYPE, type);
|
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
|
// Create the node
|
||||||
NodeRef newNodeRef = null;
|
NodeRef newNodeRef = null;
|
||||||
|
boolean autoRename = Boolean.valueOf(parameters.getParameter(RMNode.PARAM_AUTO_RENAME));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
QName typeQName = nodes.createQName(type);
|
QName typeQName = nodes.createQName(nodeType);
|
||||||
newNodeRef = fileFolderService.create(parentNodeRef, name, typeQName).getNodeRef();
|
|
||||||
|
// 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
|
// Set the provided properties if any
|
||||||
Map<QName, Serializable> qnameProperties = mapToNodeProperties(properties);
|
Map<QName, Serializable> qnameProperties = mapToNodeProperties(nodeInfo.getProperties());
|
||||||
if (qnameProperties != null)
|
if (qnameProperties != null)
|
||||||
{
|
{
|
||||||
nodeService.addProperties(newNodeRef, qnameProperties);
|
nodeService.addProperties(newNodeRef, qnameProperties);
|
||||||
@@ -630,18 +652,19 @@ public class FilePlanComponentsApiUtils
|
|||||||
if (!typeQName.equals(RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT)
|
if (!typeQName.equals(RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT)
|
||||||
&& dictionaryService.isSubClass(typeQName, ContentModel.TYPE_CONTENT))
|
&& 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
|
// Add the provided aspects if any
|
||||||
if (aspects != null)
|
List<String> aspectNames = nodeInfo.getAspectNames();
|
||||||
|
if (aspectNames != null)
|
||||||
{
|
{
|
||||||
nodes.addCustomAspects(newNodeRef, aspects, ApiNodesModelFactory.EXCLUDED_ASPECTS);
|
nodes.addCustomAspects(newNodeRef, aspectNames, ApiNodesModelFactory.EXCLUDED_ASPECTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (InvalidTypeException ex)
|
catch (InvalidTypeException ex)
|
||||||
{
|
{
|
||||||
throw new InvalidArgumentException("The given type:'" + type + "' is invalid '");
|
throw new InvalidArgumentException("The given type:'" + nodeType + "' is invalid '");
|
||||||
}
|
}
|
||||||
catch(DuplicateAttributeException ex)
|
catch(DuplicateAttributeException ex)
|
||||||
{
|
{
|
||||||
@@ -962,7 +985,45 @@ public class FilePlanComponentsApiUtils
|
|||||||
activityPoster.postFileFolderActivity(activityType, null, TenantUtil.getCurrentDomain(), activityInfo.getSiteId(),
|
activityPoster.postFileFolderActivity(activityType, null, TenantUtil.getCurrentDomain(), activityInfo.getSiteId(),
|
||||||
activityInfo.getParentNodeRef(), activityInfo.getNodeRef(), activityInfo.getFileName(), Activities.APP_TOOL,
|
activityInfo.getParentNodeRef(), activityInfo.getNodeRef(), activityInfo.getFileName(), Activities.APP_TOOL,
|
||||||
Activities.RESTAPI_CLIENT, activityInfo.getFileInfo());
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -198,6 +198,7 @@ public class SearchTypesFactory
|
|||||||
Boolean isRecordFolder = propertyWalker.getProperty(RecordCategoryChild.PARAM_IS_RECORD_FOLDER,
|
Boolean isRecordFolder = propertyWalker.getProperty(RecordCategoryChild.PARAM_IS_RECORD_FOLDER,
|
||||||
WhereClauseParser.EQUALS, Boolean.class);
|
WhereClauseParser.EQUALS, Boolean.class);
|
||||||
Boolean isRecordCategory = propertyWalker.getProperty(RecordCategoryChild.PARAM_IS_RECORD_CATEGORY, 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()))
|
if ((isRecordFolder != null && isRecordFolder.booleanValue()) || (isRecordCategory != null && !isRecordCategory.booleanValue()))
|
||||||
{
|
{
|
||||||
includeRecordFolders = true;
|
includeRecordFolders = true;
|
||||||
@@ -221,6 +222,7 @@ public class SearchTypesFactory
|
|||||||
if (nodeTypeQNameStr.equals(RecordsManagementModel.TYPE_RECORD_FOLDER))
|
if (nodeTypeQNameStr.equals(RecordsManagementModel.TYPE_RECORD_FOLDER))
|
||||||
{
|
{
|
||||||
includeRecordFolders = true;
|
includeRecordFolders = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (filterNodeTypeQName.equals(RecordsManagementModel.TYPE_RECORD_CATEGORY))
|
else if (filterNodeTypeQName.equals(RecordsManagementModel.TYPE_RECORD_CATEGORY))
|
||||||
{
|
{
|
||||||
|
@@ -57,6 +57,7 @@ public abstract class RMNode
|
|||||||
public static final String PARAM_PROPERTIES = "properties";
|
public static final String PARAM_PROPERTIES = "properties";
|
||||||
public static final String PARAM_PATH = "path";
|
public static final String PARAM_PATH = "path";
|
||||||
public static final String PARAM_ALLOWABLE_OPERATIONS = "allowableOperations";
|
public static final String PARAM_ALLOWABLE_OPERATIONS = "allowableOperations";
|
||||||
|
public static final String PARAM_AUTO_RENAME = "autoRename";
|
||||||
|
|
||||||
public static final String PARAM_ISPRIMARY = "isPrimary";
|
public static final String PARAM_ISPRIMARY = "isPrimary";
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.rm.rest.api.model;
|
package org.alfresco.rm.rest.api.model;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
||||||
@@ -50,6 +51,8 @@ public class UploadInfo
|
|||||||
|
|
||||||
public UploadInfo(FormData formData)
|
public UploadInfo(FormData formData)
|
||||||
{
|
{
|
||||||
|
properties = new HashMap<>();
|
||||||
|
|
||||||
for (FormData.FormField field : formData.getFields())
|
for (FormData.FormField field : formData.getFields())
|
||||||
{
|
{
|
||||||
switch (field.getName().toLowerCase())
|
switch (field.getName().toLowerCase())
|
||||||
|
@@ -130,7 +130,15 @@ public class RecordCategoriesEntityResource implements
|
|||||||
};
|
};
|
||||||
transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
|
transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
|
||||||
|
|
||||||
FileInfo info = fileFolderService.getFileInfo(nodeRef);
|
RetryingTransactionCallback<FileInfo> readCallback = new RetryingTransactionCallback<FileInfo>()
|
||||||
|
{
|
||||||
|
public FileInfo execute()
|
||||||
|
{
|
||||||
|
return fileFolderService.getFileInfo(nodeRef);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true);
|
||||||
|
|
||||||
return nodesModelFactory.createRecordCategory(info, parameters, null, false);
|
return nodesModelFactory.createRecordCategory(info, parameters, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,6 +33,7 @@ import static org.alfresco.util.ParameterCheck.mandatory;
|
|||||||
import java.util.AbstractList;
|
import java.util.AbstractList;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@@ -40,18 +41,22 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
import org.alfresco.query.PagingResults;
|
import org.alfresco.query.PagingResults;
|
||||||
import org.alfresco.repo.node.getchildren.FilterProp;
|
import org.alfresco.repo.node.getchildren.FilterProp;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.rest.api.Nodes;
|
import org.alfresco.rest.api.Nodes;
|
||||||
import org.alfresco.rest.api.impl.Util;
|
import org.alfresco.rest.api.impl.Util;
|
||||||
import org.alfresco.rest.api.model.UserInfo;
|
import org.alfresco.rest.api.model.UserInfo;
|
||||||
import org.alfresco.rest.framework.WebApiDescription;
|
import org.alfresco.rest.framework.WebApiDescription;
|
||||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
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.actions.interfaces.RelationshipResourceAction;
|
||||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
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.ApiNodesModelFactory;
|
||||||
import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils;
|
import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils;
|
||||||
import org.alfresco.rm.rest.api.impl.SearchTypesFactory;
|
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.namespace.QName;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.extensions.webscripts.servlet.FormData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Record category children relation
|
* 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")
|
@RelationshipResource(name="children", entityResource = RecordCategoriesEntityResource.class, title = "Children of a record category")
|
||||||
public class RecordCategoryChildrenRelation implements RelationshipResourceAction.Read<RecordCategoryChild>,
|
public class RecordCategoryChildrenRelation implements RelationshipResourceAction.Read<RecordCategoryChild>,
|
||||||
RelationshipResourceAction.Create<RecordCategoryChild>
|
RelationshipResourceAction.Create<RecordCategoryChild>,
|
||||||
|
MultiPartRelationshipResourceAction.Create<RecordCategoryChild>
|
||||||
{
|
{
|
||||||
private final static Set<String> LIST_RECORD_CATEGORY_CHILDREN_EQUALS_QUERY_PROPERTIES = new HashSet<>(Arrays
|
private final static Set<String> LIST_RECORD_CATEGORY_CHILDREN_EQUALS_QUERY_PROPERTIES = new HashSet<>(Arrays
|
||||||
.asList(new String[] { RecordCategoryChild.PARAM_IS_RECORD_CATEGORY, RecordCategoryChild.PARAM_IS_RECORD_FOLDER,
|
.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
|
// list record categories and record folders
|
||||||
Set<QName> searchTypeQNames = searchTypesFactory.buildSearchTypesCategoriesEndpoint(parameters, LIST_RECORD_CATEGORY_CHILDREN_EQUALS_QUERY_PROPERTIES);
|
Set<QName> searchTypeQNames = searchTypesFactory.buildSearchTypesCategoriesEndpoint(parameters, LIST_RECORD_CATEGORY_CHILDREN_EQUALS_QUERY_PROPERTIES);
|
||||||
|
Set<QName> assocTypeQNames = Collections.singleton(ContentModel.ASSOC_CONTAINS);
|
||||||
List<FilterProp> filterProps = apiUtils.getListChildrenFilterProps(parameters, LIST_RECORD_CATEGORY_CHILDREN_EQUALS_QUERY_PROPERTIES);
|
List<FilterProp> filterProps = apiUtils.getListChildrenFilterProps(parameters, LIST_RECORD_CATEGORY_CHILDREN_EQUALS_QUERY_PROPERTIES);
|
||||||
|
|
||||||
final PagingResults<FileInfo> pagingResults = fileFolderService.list(parentNodeRef,
|
final PagingResults<FileInfo> pagingResults = fileFolderService.list(parentNodeRef,
|
||||||
null,
|
assocTypeQNames,
|
||||||
searchTypeQNames,
|
searchTypeQNames,
|
||||||
null,
|
null,
|
||||||
apiUtils.getSortProperties(parameters),
|
apiUtils.getSortProperties(parameters),
|
||||||
@@ -189,8 +197,7 @@ public class RecordCategoryChildrenRelation implements RelationshipResourceActio
|
|||||||
RecordsManagementModel.TYPE_RECORD_CATEGORY);
|
RecordsManagementModel.TYPE_RECORD_CATEGORY);
|
||||||
}
|
}
|
||||||
// Create the node
|
// Create the node
|
||||||
NodeRef newNode = apiUtils.createRMNode(nodeParent, nodeInfo.getName(), nodeInfo.getNodeType(),
|
NodeRef newNode = apiUtils.createRMNode(nodeParent, nodeInfo, parameters);
|
||||||
nodeInfo.getProperties(), nodeInfo.getAspectNames());
|
|
||||||
createdNodes.add(newNode);
|
createdNodes.add(newNode);
|
||||||
}
|
}
|
||||||
return createdNodes;
|
return createdNodes;
|
||||||
@@ -206,4 +213,10 @@ public class RecordCategoryChildrenRelation implements RelationshipResourceActio
|
|||||||
|
|
||||||
return result;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -167,7 +167,7 @@ public class RecordFolderChildrenRelation implements RelationshipResourceAction.
|
|||||||
List<NodeRef> createdNodes = new LinkedList<>();
|
List<NodeRef> createdNodes = new LinkedList<>();
|
||||||
for (Record nodeInfo : nodeInfos)
|
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);
|
createdNodes.add(newNodeRef);
|
||||||
}
|
}
|
||||||
return createdNodes;
|
return createdNodes;
|
||||||
|
@@ -125,7 +125,15 @@ public class RecordFolderEntityResource implements EntityResourceAction.ReadById
|
|||||||
};
|
};
|
||||||
transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
|
transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
|
||||||
|
|
||||||
FileInfo info = fileFolderService.getFileInfo(nodeRef);
|
RetryingTransactionCallback<FileInfo> readCallback = new RetryingTransactionCallback<FileInfo>()
|
||||||
|
{
|
||||||
|
public FileInfo execute()
|
||||||
|
{
|
||||||
|
return fileFolderService.getFileInfo(nodeRef);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true);
|
||||||
|
|
||||||
return nodesModelFactory.createRecordFolder(info, parameters, null, false);
|
return nodesModelFactory.createRecordFolder(info, parameters, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -217,7 +217,15 @@ public class RecordsEntityResource implements BinaryResourceAction.Read,
|
|||||||
transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
|
transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
|
||||||
|
|
||||||
// return record state
|
// return record state
|
||||||
FileInfo info = fileFolderService.getFileInfo(record);
|
RetryingTransactionCallback<FileInfo> readCallback = new RetryingTransactionCallback<FileInfo>()
|
||||||
|
{
|
||||||
|
public FileInfo execute()
|
||||||
|
{
|
||||||
|
return fileFolderService.getFileInfo(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true);
|
||||||
|
|
||||||
apiUtils.postActivity(info, recordInfo.getParentId(), ActivityType.FILE_UPDATED);
|
apiUtils.postActivity(info, recordInfo.getParentId(), ActivityType.FILE_UPDATED);
|
||||||
return nodesModelFactory.createRecord(info, parameters, null, false);
|
return nodesModelFactory.createRecord(info, parameters, null, false);
|
||||||
}
|
}
|
||||||
|
@@ -128,7 +128,15 @@ public class TransferContainerEntityResource implements
|
|||||||
};
|
};
|
||||||
transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
|
transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
|
||||||
|
|
||||||
FileInfo info = fileFolderService.getFileInfo(nodeRef);
|
RetryingTransactionCallback<FileInfo> readCallback = new RetryingTransactionCallback<FileInfo>()
|
||||||
|
{
|
||||||
|
public FileInfo execute()
|
||||||
|
{
|
||||||
|
return fileFolderService.getFileInfo(nodeRef);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true);
|
||||||
|
|
||||||
return nodesModelFactory.createTransferContainer(info, parameters, null, false);
|
return nodesModelFactory.createTransferContainer(info, parameters, null, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -186,7 +186,7 @@ public class UnfiledContainerChildrenRelation implements RelationshipResourceAct
|
|||||||
List<NodeRef> createdNodes = new LinkedList<>();
|
List<NodeRef> createdNodes = new LinkedList<>();
|
||||||
for (UnfiledContainerChild nodeInfo : nodeInfos)
|
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);
|
createdNodes.add(newNodeRef);
|
||||||
}
|
}
|
||||||
return createdNodes;
|
return createdNodes;
|
||||||
|
@@ -126,7 +126,15 @@ public class UnfiledContainerEntityResource
|
|||||||
};
|
};
|
||||||
transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
|
transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
|
||||||
|
|
||||||
FileInfo info = fileFolderService.getFileInfo(nodeRef);
|
RetryingTransactionCallback<FileInfo> readCallback = new RetryingTransactionCallback<FileInfo>()
|
||||||
|
{
|
||||||
|
public FileInfo execute()
|
||||||
|
{
|
||||||
|
return fileFolderService.getFileInfo(nodeRef);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true);
|
||||||
|
|
||||||
apiUtils.postActivity(info, unfiledContainerInfo.getParentId(), ActivityType.FILE_UPDATED);
|
apiUtils.postActivity(info, unfiledContainerInfo.getParentId(), ActivityType.FILE_UPDATED);
|
||||||
return nodesModelFactory.createUnfiledContainer(info, parameters, null, false);
|
return nodesModelFactory.createUnfiledContainer(info, parameters, null, false);
|
||||||
}
|
}
|
||||||
|
@@ -193,7 +193,7 @@ public class UnfiledRecordFolderChildrenRelation implements RelationshipResource
|
|||||||
nodeParent = parentNodeRef;
|
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);
|
createdNodes.add(newNodeRef);
|
||||||
}
|
}
|
||||||
return createdNodes;
|
return createdNodes;
|
||||||
|
@@ -130,7 +130,15 @@ public class UnfiledRecordFolderEntityResource implements EntityResourceAction.R
|
|||||||
};
|
};
|
||||||
transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
|
transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
|
||||||
|
|
||||||
FileInfo info = fileFolderService.getFileInfo(nodeRef);
|
RetryingTransactionCallback<FileInfo> readCallback = new RetryingTransactionCallback<FileInfo>()
|
||||||
|
{
|
||||||
|
public FileInfo execute()
|
||||||
|
{
|
||||||
|
return fileFolderService.getFileInfo(nodeRef);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true);
|
||||||
|
|
||||||
apiUtils.postActivity(info, unfiledRecordFolderInfo.getParentId(), ActivityType.FILE_UPDATED);
|
apiUtils.postActivity(info, unfiledRecordFolderInfo.getParentId(), ActivityType.FILE_UPDATED);
|
||||||
return nodesModelFactory.createUnfiledRecordFolder(info, parameters, null, false);
|
return nodesModelFactory.createUnfiledRecordFolder(info, parameters, null, false);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user