This commit is contained in:
Rodica Sutu
2018-09-10 12:50:01 +03:00
18 changed files with 233 additions and 67 deletions

10
pom.xml
View File

@@ -4,7 +4,7 @@
<groupId>org.alfresco</groupId> <groupId>org.alfresco</groupId>
<artifactId>alfresco-rm</artifactId> <artifactId>alfresco-rm</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>2.7.1-SNAPSHOT</version> <version>2.7.2-SNAPSHOT</version>
<name>Alfresco Records Management</name> <name>Alfresco Records Management</name>
<parent> <parent>
@@ -198,6 +198,8 @@
<argLine>-Xmx1024m -XX:MaxPermSize=256m -Duser.language=en -Dcom.sun.management.jmxremote</argLine> <argLine>-Xmx1024m -XX:MaxPermSize=256m -Duser.language=en -Dcom.sun.management.jmxremote</argLine>
<license.update.dryrun>true</license.update.dryrun> <license.update.dryrun>true</license.update.dryrun>
<license.verbose>false</license.verbose> <license.verbose>false</license.verbose>
<!-- Prevent the module from being added to inappropriate versions of the WAR file !-->
<alfresco.min.version>5.2.4</alfresco.min.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@@ -254,9 +256,9 @@
<regexPropertySettings> <regexPropertySettings>
<regexPropertySetting> <regexPropertySetting>
<name>rm.module.repo.version.min</name> <name>rm.module.repo.version.min</name>
<value>${alfresco.version}</value> <value>${alfresco.min.version}</value>
<regex>(\d+)\.(\d+).*</regex> <regex>(\d+)\.(\d+).(\d+).*</regex>
<replacement>$1.$2</replacement> <replacement>$1.$2.$3</replacement>
<failIfNoMatch>false</failIfNoMatch> <failIfNoMatch>false</failIfNoMatch>
</regexPropertySetting> </regexPropertySetting>
<regexPropertySetting> <regexPropertySetting>

View File

@@ -8,7 +8,7 @@
<parent> <parent>
<groupId>org.alfresco</groupId> <groupId>org.alfresco</groupId>
<artifactId>alfresco-rm</artifactId> <artifactId>alfresco-rm</artifactId>
<version>2.7.1-SNAPSHOT</version> <version>2.7.2-SNAPSHOT</version>
</parent> </parent>
<licenses> <licenses>
@@ -145,6 +145,7 @@
</goals> </goals>
<configuration> <configuration>
<artifactItems> <artifactItems>
<!-- Due to no compatible community version of ACS 5.2.N with RM community
<artifactItem> <artifactItem>
<groupId>org.alfresco</groupId> <groupId>org.alfresco</groupId>
<artifactId>alfresco-rm-community-share</artifactId> <artifactId>alfresco-rm-community-share</artifactId>
@@ -157,6 +158,19 @@
<version>${project.version}</version> <version>${project.version}</version>
<type>amp</type> <type>amp</type>
</artifactItem> </artifactItem>
!-->
<artifactItem>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-rm-enterprise-share</artifactId>
<version>${project.version}</version>
<type>amp</type>
</artifactItem>
<artifactItem>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-rm-enterprise-repo</artifactId>
<version>${project.version}</version>
<type>amp</type>
</artifactItem>
</artifactItems> </artifactItems>
<outputDirectory>${project.build.directory}/amps</outputDirectory> <outputDirectory>${project.build.directory}/amps</outputDirectory>
<useBaseVersion>true</useBaseVersion> <useBaseVersion>true</useBaseVersion>
@@ -178,7 +192,7 @@
<configuration> <configuration>
<backup>true</backup> <backup>true</backup>
<ampLocation> <ampLocation>
${project.build.directory}/amps/alfresco-rm-community-repo-${project.version}.amp ${project.build.directory}/amps/alfresco-rm-enterprise-repo-${project.version}.amp
</ampLocation> </ampLocation>
<warLocation>${project.build.directory}/alf-installation/tomcat/webapps/alfresco.war <warLocation>${project.build.directory}/alf-installation/tomcat/webapps/alfresco.war
</warLocation> </warLocation>
@@ -193,7 +207,7 @@
<configuration> <configuration>
<backup>true</backup> <backup>true</backup>
<ampLocation> <ampLocation>
${project.build.directory}/amps/alfresco-rm-community-share-${project.version}.amp ${project.build.directory}/amps/alfresco-rm-enterprise-share-${project.version}.amp
</ampLocation> </ampLocation>
<warLocation>${project.build.directory}/alf-installation/tomcat/webapps/share.war <warLocation>${project.build.directory}/alf-installation/tomcat/webapps/share.war
</warLocation> </warLocation>

View File

@@ -8,7 +8,7 @@
<parent> <parent>
<groupId>org.alfresco</groupId> <groupId>org.alfresco</groupId>
<artifactId>alfresco-rm-automation</artifactId> <artifactId>alfresco-rm-automation</artifactId>
<version>2.7.1-SNAPSHOT</version> <version>2.7.2-SNAPSHOT</version>
</parent> </parent>
<properties> <properties>

View File

@@ -92,15 +92,29 @@ public class RestAPIFactory
return getRmRestWrapper().withSearchAPI(); return getRmRestWrapper().withSearchAPI();
} }
public Node getNodeAPI(RepoTestModel model) throws Exception public Node getNodeAPI(RepoTestModel model) throws RuntimeException
{
try
{ {
return getCoreAPI(null).usingNode(model); return getCoreAPI(null).usingNode(model);
} }
catch (Exception e)
{
throw new RuntimeException("Failed to load nodeAPI.", e);
}
}
public Node getNodeAPI(UserModel userModel, RepoTestModel model) throws Exception public Node getNodeAPI(UserModel userModel, RepoTestModel model) throws RuntimeException
{
try
{ {
return getCoreAPI(userModel).usingNode(model); return getCoreAPI(userModel).usingNode(model);
} }
catch (Exception e)
{
throw new RuntimeException("Failed to load nodeAPI.", e);
}
}
public RMSiteAPI getRMSiteAPI() public RMSiteAPI getRMSiteAPI()
{ {

View File

@@ -26,6 +26,8 @@
*/ */
package org.alfresco.rest.rm.community.model.common; package org.alfresco.rest.rm.community.model.common;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@@ -50,4 +52,10 @@ public class IdNamePair
@JsonProperty (required = true) @JsonProperty (required = true)
private String name; private String name;
@JsonProperty (required = true)
private List<String> aspectNames;
@JsonProperty (required = true)
private String nodeType;
} }

View File

@@ -135,7 +135,7 @@ public class FilePlanAPI extends RMModelRequest
/** /**
* see {@link #createRootRecordCategory(RecordCategory, String, String)} * see {@link #createRootRecordCategory(RecordCategory, String, String)}
*/ */
public RecordCategory createRootRecordCategory(RecordCategory recordCategoryModel, String filePlanId) throws Exception public RecordCategory createRootRecordCategory(RecordCategory recordCategoryModel, String filePlanId)
{ {
mandatoryObject("recordCategoryModel", recordCategoryModel); mandatoryObject("recordCategoryModel", recordCategoryModel);
mandatoryString("filePlanId", filePlanId); mandatoryString("filePlanId", filePlanId);
@@ -150,7 +150,7 @@ public class FilePlanAPI extends RMModelRequest
* @param filePlanId The identifier of a file plan * @param filePlanId The identifier of a file plan
* @param parameters The URL parameters to add * @param parameters The URL parameters to add
* @return The created {@link RecordCategory} * @return The created {@link RecordCategory}
* @throws Exception for the following cases: * @throws RuntimeException for the following cases:
* <ul> * <ul>
* <li>{@code filePlanId} is not a valid format or {@code filePlanId} is invalid</li> * <li>{@code filePlanId} is not a valid format or {@code filePlanId} is invalid</li>
* <li>authentication fails</li> * <li>authentication fails</li>
@@ -160,7 +160,7 @@ public class FilePlanAPI extends RMModelRequest
* <li>model integrity exception, including node name with invalid characters</li> * <li>model integrity exception, including node name with invalid characters</li>
* </ul> * </ul>
*/ */
public RecordCategory createRootRecordCategory(RecordCategory recordCategoryModel, String filePlanId, String parameters) throws Exception public RecordCategory createRootRecordCategory(RecordCategory recordCategoryModel, String filePlanId, String parameters)
{ {
mandatoryObject("recordCategoryModel", recordCategoryModel); mandatoryObject("recordCategoryModel", recordCategoryModel);
mandatoryString("filePlanId", filePlanId); mandatoryString("filePlanId", filePlanId);

View File

@@ -201,7 +201,7 @@ public class RecordCategoryAPI extends RMModelRequest
/** /**
* see {@link #createRecordCategoryChild(RecordCategoryChild, String, String)} * see {@link #createRecordCategoryChild(RecordCategoryChild, String, String)}
*/ */
public RecordCategoryChild createRecordCategoryChild(RecordCategoryChild recordCategoryChildModel, String recordCategoryId) throws Exception public RecordCategoryChild createRecordCategoryChild(RecordCategoryChild recordCategoryChildModel, String recordCategoryId)
{ {
mandatoryObject("recordCategoryChildModel", recordCategoryChildModel); mandatoryObject("recordCategoryChildModel", recordCategoryChildModel);
mandatoryString("recordCategoryId", recordCategoryId); mandatoryString("recordCategoryId", recordCategoryId);
@@ -216,7 +216,7 @@ public class RecordCategoryAPI extends RMModelRequest
* @param recordCategoryId The identifier of a record category * @param recordCategoryId The identifier of a record category
* @param parameters The URL parameters to add * @param parameters The URL parameters to add
* @return The created {@link RecordCategoryChild} * @return The created {@link RecordCategoryChild}
* @throws Exception for the following cases: * @throws RuntimeException for the following cases:
* <ul> * <ul>
* <li>{@code recordCategoryId} is not a valid format or {@code recordCategoryChildModel} is invalid</li> * <li>{@code recordCategoryId} is not a valid format or {@code recordCategoryChildModel} is invalid</li>
* <li>authentication fails</li> * <li>authentication fails</li>
@@ -226,7 +226,7 @@ public class RecordCategoryAPI extends RMModelRequest
* <li>model integrity exception, including node name with invalid characters</li> * <li>model integrity exception, including node name with invalid characters</li>
* </ul> * </ul>
*/ */
public RecordCategoryChild createRecordCategoryChild(RecordCategoryChild recordCategoryChildModel, String recordCategoryId, String parameters) throws Exception public RecordCategoryChild createRecordCategoryChild(RecordCategoryChild recordCategoryChildModel, String recordCategoryId, String parameters)
{ {
mandatoryObject("filePlanComponentProperties", recordCategoryChildModel); mandatoryObject("filePlanComponentProperties", recordCategoryChildModel);
mandatoryString("recordCategoryId", recordCategoryId); mandatoryString("recordCategoryId", recordCategoryId);

View File

@@ -40,6 +40,7 @@ import static org.springframework.http.HttpMethod.PUT;
import static org.testng.Assert.fail; import static org.testng.Assert.fail;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
@@ -212,7 +213,7 @@ public class RecordFolderAPI extends RMModelRequest
/** /**
* see {@link #createRecord(Record, String, String)} * see {@link #createRecord(Record, String, String)}
*/ */
public Record createRecord(Record recordModel, String recordFolderId) throws Exception public Record createRecord(Record recordModel, String recordFolderId)
{ {
mandatoryObject("recordModel", recordModel); mandatoryObject("recordModel", recordModel);
mandatoryString("recordFolderId", recordFolderId); mandatoryString("recordFolderId", recordFolderId);
@@ -227,9 +228,9 @@ public class RecordFolderAPI extends RMModelRequest
* @param recordContent {@link File} pointing to the content of the electronic record to be created * @param recordContent {@link File} pointing to the content of the electronic record to be created
* @param recordFolderId The identifier of a record folder * @param recordFolderId The identifier of a record folder
* @return newly created {@link Record} * @return newly created {@link Record}
* @throws Exception for invalid recordModel JSON strings * @throws RuntimeException for invalid recordModel JSON strings
*/ */
public Record createRecord(Record recordModel, String recordFolderId, File recordContent) throws Exception public Record createRecord(Record recordModel, String recordFolderId, File recordContent) throws RuntimeException
{ {
mandatoryString("recordFolderId", recordFolderId); mandatoryString("recordFolderId", recordFolderId);
mandatoryObject("recordContent", recordContent); mandatoryObject("recordContent", recordContent);
@@ -245,7 +246,15 @@ public class RecordFolderAPI extends RMModelRequest
* to the request. * to the request.
*/ */
RequestSpecBuilder builder = getRmRestWrapper().configureRequestSpec(); RequestSpecBuilder builder = getRmRestWrapper().configureRequestSpec();
JsonNode root = new ObjectMapper().readTree(toJson(recordModel, Record.class, FilePlanComponentMixIn.class)); JsonNode root;
try
{
root = new ObjectMapper().readTree(toJson(recordModel, Record.class, FilePlanComponentMixIn.class));
}
catch (IOException e)
{
throw new RuntimeException("Failed to convert model to JSON.", e);
}
// add request fields // add request fields
Iterator<String> fieldNames = root.fieldNames(); Iterator<String> fieldNames = root.fieldNames();
while (fieldNames.hasNext()) while (fieldNames.hasNext())
@@ -266,7 +275,7 @@ public class RecordFolderAPI extends RMModelRequest
* @param recordFolderId The identifier of a record folder * @param recordFolderId The identifier of a record folder
* @param parameters The URL parameters to add * @param parameters The URL parameters to add
* @return The created {@link Record} * @return The created {@link Record}
* @throws Exception for the following cases: * @throws RuntimeException for the following cases:
* <ul> * <ul>
* <li>{@code recordFolderId is not a valid format or {@code recordModel} is invalid</li> * <li>{@code recordFolderId is not a valid format or {@code recordModel} is invalid</li>
* <li>authentication fails</li> * <li>authentication fails</li>
@@ -275,7 +284,7 @@ public class RecordFolderAPI extends RMModelRequest
* <li>model integrity exception, including node name with invalid characters</li> * <li>model integrity exception, including node name with invalid characters</li>
* </ul> * </ul>
*/ */
public Record createRecord(Record recordModel, String recordFolderId, String parameters) throws Exception public Record createRecord(Record recordModel, String recordFolderId, String parameters)
{ {
mandatoryObject("recordModel", recordModel); mandatoryObject("recordModel", recordModel);
mandatoryString("recordFolderId", recordFolderId); mandatoryString("recordFolderId", recordFolderId);

View File

@@ -217,9 +217,9 @@ public class BaseRMRestTest extends RestTest
* @param userModel The user under whose privileges this structure is going to be created * @param userModel The user under whose privileges this structure is going to be created
* @param categoryName The name of the category * @param categoryName The name of the category
* @return The created category * @return The created category
* @throws Exception on unsuccessful component creation * @throws RuntimeException on unsuccessful component creation
*/ */
public RecordCategory createRootCategory(UserModel userModel, String categoryName) throws Exception public RecordCategory createRootCategory(UserModel userModel, String categoryName)
{ {
return createRootCategory(userModel, categoryName, RECORD_CATEGORY_TITLE); return createRootCategory(userModel, categoryName, RECORD_CATEGORY_TITLE);
} }
@@ -244,9 +244,9 @@ public class BaseRMRestTest extends RestTest
* @param categoryName The name of the category * @param categoryName The name of the category
* @param categoryTitle The title of the category * @param categoryTitle The title of the category
* @return The created category * @return The created category
* @throws Exception on unsuccessful component creation * @throws RuntimeException on unsuccessful component creation
*/ */
public RecordCategory createRootCategory(UserModel userModel, String categoryName, String categoryTitle) throws Exception public RecordCategory createRootCategory(UserModel userModel, String categoryName, String categoryTitle)
{ {
RecordCategory recordCategoryModel = createRecordCategoryModel(categoryName, categoryTitle); RecordCategory recordCategoryModel = createRecordCategoryModel(categoryName, categoryTitle);
return getRestAPIFactory().getFilePlansAPI(userModel).createRootRecordCategory(recordCategoryModel, FILE_PLAN_ALIAS); return getRestAPIFactory().getFilePlansAPI(userModel).createRootRecordCategory(recordCategoryModel, FILE_PLAN_ALIAS);
@@ -315,9 +315,9 @@ public class BaseRMRestTest extends RestTest
* @param recordCategoryId The id of the record category * @param recordCategoryId The id of the record category
* @param name The name of the folder * @param name The name of the folder
* @return The created folder * @return The created folder
* @throws Exception on unsuccessful component creation * @throws RuntimeException on unsuccessful component creation
*/ */
public RecordCategoryChild createFolder(UserModel user, String recordCategoryId, String name) throws Exception public RecordCategoryChild createFolder(UserModel user, String recordCategoryId, String name)
{ {
RecordCategoryChild recordFolderModel = createRecordCategoryChildModel(name, RECORD_FOLDER_TYPE); RecordCategoryChild recordFolderModel = createRecordCategoryChildModel(name, RECORD_FOLDER_TYPE);
return getRestAPIFactory().getRecordCategoryAPI(user).createRecordCategoryChild(recordFolderModel, recordCategoryId); return getRestAPIFactory().getRecordCategoryAPI(user).createRecordCategoryChild(recordFolderModel, recordCategoryId);
@@ -455,13 +455,13 @@ public class BaseRMRestTest extends RestTest
} }
/** /**
* Helper method to create a randomly-named <category>/<folder> structure in file plan * Helper method to create a randomly-named [category]/[folder] structure in file plan
* *
* @param user The user under whose privileges this structure is going to be created * @param user The user under whose privileges this structure is going to be created
* @return {@link RecordCategoryChild} which represents the record folder * @return {@link RecordCategoryChild} which represents the record folder
* @throws Exception on failed creation * @throws RuntimeException on failed creation
*/ */
public RecordCategoryChild createCategoryFolderInFilePlan(UserModel user) throws Exception public RecordCategoryChild createCategoryFolderInFilePlan(UserModel user)
{ {
// create root category // create root category
RecordCategory recordCategory = createRootCategory(user, "Category " + getRandomAlphanumeric()); RecordCategory recordCategory = createRootCategory(user, "Category " + getRandomAlphanumeric());
@@ -471,12 +471,12 @@ public class BaseRMRestTest extends RestTest
} }
/** /**
* Helper method to create a randomly-named <category>/<folder> structure in file plan as the admin user * Helper method to create a randomly-named [category]/[folder] structure in file plan as the admin user
* *
* @return {@link RecordCategoryChild} which represents the record folder * @return {@link RecordCategoryChild} which represents the record folder
* @throws Exception on failed creation * @throws RuntimeException on failed creation
*/ */
public RecordCategoryChild createCategoryFolderInFilePlan() throws Exception public RecordCategoryChild createCategoryFolderInFilePlan()
{ {
return createCategoryFolderInFilePlan(getAdminUser()); return createCategoryFolderInFilePlan(getAdminUser());
} }

View File

@@ -46,6 +46,10 @@ import static org.springframework.http.HttpStatus.NOT_FOUND;
import static org.springframework.http.HttpStatus.NO_CONTENT; import static org.springframework.http.HttpStatus.NO_CONTENT;
import static org.springframework.http.HttpStatus.OK; import static org.springframework.http.HttpStatus.OK;
import org.alfresco.rest.core.RestResponse;
import org.alfresco.rest.model.RestNodeBodyMoveCopyModel;
import org.alfresco.rest.model.RestNodeModel;
import org.alfresco.rest.requests.Node;
import org.alfresco.rest.rm.community.base.BaseRMRestTest; import org.alfresco.rest.rm.community.base.BaseRMRestTest;
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.RecordCategoryChild; import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
@@ -55,8 +59,10 @@ import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI; import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
import org.alfresco.test.AlfrescoTest; import org.alfresco.test.AlfrescoTest;
import org.alfresco.utility.data.RandomData; import org.alfresco.utility.data.RandomData;
import org.alfresco.utility.model.RepoTestModel;
import org.alfresco.utility.model.SiteModel; import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.UserModel; import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.report.log.Step;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
@@ -245,6 +251,40 @@ public class DeleteRecordTests extends BaseRMRestTest
assertStatusCode(FORBIDDEN); assertStatusCode(FORBIDDEN);
} }
/**
* <pre>
* Given a record
* And a copy of that record
* When I delete the copy
* Then it is still possible to view the content of the original record
* </pre>
*/
@Test(description = "Deleting copy of record doesn't delete original content")
@AlfrescoTest(jira="MNT-18806")
public void deleteCopyOfRecord()
{
Step.STEP("Create two record categories and folders.");
RecordCategoryChild recordFolderA = createCategoryFolderInFilePlan();
RecordCategoryChild recordFolderB = createCategoryFolderInFilePlan();
Step.STEP("Create a record in folder A and copy it into folder B.");
String recordId = getRestAPIFactory().getRecordFolderAPI()
.createRecord(createElectronicRecordModel(), recordFolderA.getId(), getFile(IMAGE_FILE)).getId();
String copyId = copyRecord(recordId, recordFolderB.getId()).getId();
assertStatusCode(CREATED);
Step.STEP("Check that it's possible to load the original content.");
getNodeContent(recordId);
assertStatusCode(OK);
Step.STEP("Delete the copy.");
deleteAndVerify(copyId);
Step.STEP("Check that the original record node and content still exist.");
checkNodeExists(recordId);
getNodeContent(recordId);
}
/** /**
* Utility method to delete a record and verify successful deletion * Utility method to delete a record and verify successful deletion
* *
@@ -263,4 +303,73 @@ public class DeleteRecordTests extends BaseRMRestTest
assertStatusCode(NOT_FOUND); assertStatusCode(NOT_FOUND);
} }
/**
* Copy a record to a record folder.
*
* @param recordId The id of the record to copy.
* @param destinationFolder The id of the record folder to copy it to.
* @return The model returned by the copy API.
*/
private RestNodeModel copyRecord(String recordId, String destinationFolder)
{
Node node = getNode(recordId);
RestNodeBodyMoveCopyModel copyBody = new RestNodeBodyMoveCopyModel();
copyBody.setTargetParentId(destinationFolder);
try
{
return node.copy(copyBody);
}
catch (Exception e)
{
throw new RuntimeException("Problem copying record.", e);
}
}
/**
* Get the content from a node.
*
* @param nodeId
* @return The response containing the node content.
*/
private RestResponse getNodeContent(String nodeId)
{
try
{
return getNode(nodeId).getNodeContent();
}
catch (Exception e)
{
throw new RuntimeException("Failed to load content for node.", e);
}
}
/**
* Check that the given node exists.
*
* @param nodeId The node to check.
*/
private void checkNodeExists(String nodeId)
{
try
{
getNode(nodeId).getNode();
}
catch (Exception e)
{
throw new RuntimeException("Node does not exist.", e);
}
}
/**
* Get the node from a record id.
*
* @param recordId The record to get.
* @return The node object.
*/
private Node getNode(String recordId)
{
RepoTestModel repoTestModel = new RepoTestModel() {};
repoTestModel.setNodeRef(recordId);
return getRestAPIFactory().getNodeAPI(repoTestModel);
}
} }

View File

@@ -8,7 +8,7 @@
<parent> <parent>
<groupId>org.alfresco</groupId> <groupId>org.alfresco</groupId>
<artifactId>alfresco-rm</artifactId> <artifactId>alfresco-rm</artifactId>
<version>2.7.1-SNAPSHOT</version> <version>2.7.2-SNAPSHOT</version>
</parent> </parent>
<licenses> <licenses>
@@ -43,7 +43,7 @@
</dependencyManagement> </dependencyManagement>
<properties> <properties>
<alfresco.version>5.2.g</alfresco.version> <alfresco.version>5.2.4</alfresco.version>
<share.version>5.2.f</share.version> <share.version>5.2.4</share.version>
</properties> </properties>
</project> </project>

View File

@@ -143,6 +143,7 @@
<property name="recordService" ref="RecordService" /> <property name="recordService" ref="RecordService" />
<property name="dispositionService" ref="DispositionService" /> <property name="dispositionService" ref="DispositionService" />
<property name="quickShareService" ref="QuickShareService"/> <property name="quickShareService" ref="QuickShareService"/>
<property name="fileFolderService" ref="FileFolderService"/>
</bean> </bean>
<bean id="rma.recordComponentIdentifier" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.RecordComponentIdentifierAspect" parent="rm.baseBehaviour"> <bean id="rma.recordComponentIdentifier" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.RecordComponentIdentifierAspect" parent="rm.baseBehaviour">

View File

@@ -202,7 +202,7 @@
</bean> </bean>
<!-- Map RM exceptions to HTML status codes --> <!-- Map RM exceptions to HTML status codes -->
<bean id="rm.simpleMappingExceptionResolver" abstract="true" parent="simpleMappingExceptionResolver"> <bean id="rm.simpleMappingExceptionResolver" abstract="true" parent="simpleMappingExceptionResolverParent">
<property name="exceptionMappings"> <property name="exceptionMappings">
<map merge="true"> <map merge="true">
<entry key="org.alfresco.service.cmr.attributes.DuplicateAttributeException" value="#{T(org.springframework.extensions.webscripts.Status).STATUS_CONFLICT}" /> <entry key="org.alfresco.service.cmr.attributes.DuplicateAttributeException" value="#{T(org.springframework.extensions.webscripts.Status).STATUS_CONFLICT}" />
@@ -212,7 +212,7 @@
</property> </property>
</bean> </bean>
<bean class="org.alfresco.util.BeanExtender"> <bean class="org.alfresco.util.BeanExtender">
<property name="beanName" value="simpleMappingExceptionResolver"/> <property name="beanName" value="simpleMappingExceptionResolverParent"/>
<property name="extendingBeanName" value="rm.simpleMappingExceptionResolver"/> <property name="extendingBeanName" value="rm.simpleMappingExceptionResolver"/>
</bean> </bean>
</beans> </beans>

View File

@@ -9,7 +9,7 @@
<parent> <parent>
<groupId>org.alfresco</groupId> <groupId>org.alfresco</groupId>
<artifactId>alfresco-rm-community</artifactId> <artifactId>alfresco-rm-community</artifactId>
<version>2.7.1-SNAPSHOT</version> <version>2.7.2-SNAPSHOT</version>
</parent> </parent>
<properties> <properties>

View File

@@ -51,9 +51,13 @@ import org.alfresco.repo.policy.annotation.BehaviourBean;
import org.alfresco.repo.policy.annotation.BehaviourKind; import org.alfresco.repo.policy.annotation.BehaviourKind;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.quickshare.QuickShareService; import org.alfresco.service.cmr.quickshare.QuickShareService;
import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentData; import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.ScriptService; import org.alfresco.service.cmr.repository.ScriptService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
@@ -94,6 +98,9 @@ public class RecordAspect extends AbstractDisposableItem
/** quickShare service */ /** quickShare service */
private QuickShareService quickShareService; private QuickShareService quickShareService;
/** File folder service */
private FileFolderService fileFolderService;
/** I18N */ /** I18N */
private static final String MSG_CANNOT_UPDATE_RECORD_CONTENT = "rm.service.update-record-content"; private static final String MSG_CANNOT_UPDATE_RECORD_CONTENT = "rm.service.update-record-content";
@@ -130,6 +137,15 @@ public class RecordAspect extends AbstractDisposableItem
this.quickShareService = quickShareService; this.quickShareService = quickShareService;
} }
/**
*
* @param fileFolderService file folder service
*/
public void setFileFolderService(FileFolderService fileFolderService)
{
this.fileFolderService = fileFolderService;
}
/** /**
* Behaviour to ensure renditions have the appropriate extended security. * Behaviour to ensure renditions have the appropriate extended security.
* *
@@ -358,6 +374,14 @@ public class RecordAspect extends AbstractDisposableItem
{ {
// then remove any extended security from the newly copied record // then remove any extended security from the newly copied record
extendedSecurityService.remove(targetNodeRef); extendedSecurityService.remove(targetNodeRef);
//create a new content URL for the copy
ContentReader reader = fileFolderService.getReader(targetNodeRef);
if (reader != null)
{
ContentWriter writer = fileFolderService.getWriter(targetNodeRef);
writer.putContent(reader);
}
} }
} }

View File

@@ -36,10 +36,6 @@ import java.util.Map;
import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.api.AlfrescoPublicApi;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.cmr.repository.datatype.TypeConversionException;
import org.alfresco.service.cmr.repository.datatype.TypeConverter;
import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.json.JSONArray; import org.json.JSONArray;
@@ -382,19 +378,4 @@ public class RecordsManagementSearchParameters
return includedContainerTypes; return includedContainerTypes;
} }
// This code needs to be removed once MNT-14795 (Search does not work when RM is installed) has been fixed.
static
{
DefaultTypeConverter.INSTANCE.addConverter(
SearchParameters.class,
String.class,
new TypeConverter.Converter<SearchParameters, String>()
{
public String convert(SearchParameters source)
{
throw new TypeConversionException("Dummy converter! Should throw a TypeConversionException");
}
}
);
}
} }

View File

@@ -39,12 +39,14 @@ import java.io.Serializable;
import java.nio.charset.Charset; import java.nio.charset.Charset;
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.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import net.sf.acegisecurity.vote.AccessDecisionVoter;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
@@ -110,8 +112,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.social.InternalServerErrorException; import org.springframework.social.InternalServerErrorException;
import net.sf.acegisecurity.vote.AccessDecisionVoter;
/** /**
* Utility class that handles common api endpoint tasks * Utility class that handles common api endpoint tasks
* *
@@ -968,7 +968,11 @@ public class FilePlanComponentsApiUtils
if (permissionService.hasPermission(childNodeRef, PermissionService.READ) == AccessStatus.ALLOWED) if (permissionService.hasPermission(childNodeRef, PermissionService.READ) == AccessStatus.ALLOWED)
{ {
Serializable nameProp = nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME); Serializable nameProp = nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME);
pathElements.add(0, new ElementInfo(childNodeRef.getId(), nameProp.toString())); String type = nodeService.getType(childNodeRef).toPrefixString();
Set<QName> aspects = nodeService.getAspects(childNodeRef);
List<String> aspectNames = nodes.mapFromNodeAspects(aspects, Collections.emptyList(), Collections.emptyList());
pathElements.add(0, new ElementInfo(childNodeRef.getId(), nameProp.toString(), type, aspectNames));
} }
else else
{ {

View File

@@ -7,11 +7,11 @@
<parent> <parent>
<groupId>org.alfresco</groupId> <groupId>org.alfresco</groupId>
<artifactId>alfresco-rm-community</artifactId> <artifactId>alfresco-rm-community</artifactId>
<version>2.7.1-SNAPSHOT</version> <version>2.7.2-SNAPSHOT</version>
</parent> </parent>
<properties> <properties>
<alfresco.api.explorer.version>5.2.0.1</alfresco.api.explorer.version> <alfresco.api.explorer.version>5.2.2</alfresco.api.explorer.version>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>