From 96498ee7b0472cdea562f09aa372b513fd72ef6d Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Fri, 20 Oct 2017 11:50:29 +0100 Subject: [PATCH 1/7] RM-5792 Adding in placeholder Mirrored from community commit 146eba847fe1472df2dc2d5cd51e1b828a6844c8 --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..bb4b953354 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,2 @@ +placeholder + From 5107b2ce2011a8904dead31a28f9b01e2b2652fa Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Tue, 24 Oct 2017 16:15:56 +0100 Subject: [PATCH 2/7] RM-5792 adding first draft on contributing doc Mirrored from community commit 7e2df793a0d4b5a41ef35fe2786066cc94e1158e --- CONTRIBUTING.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bb4b953354..7e5896fb2b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,2 +1,58 @@ -placeholder +#How to contribute +Alfresco's maturity comes from the contributions of its community. Contributing back to Alfresco can be a bit confusing as Alfresco is a collection of separate open source projects. Each open source project officially sponsored by Alfresco has a page in this space detailing its governance policy and the method for reporting issues and submitting contributions. + +For the details on the Records Management project see[here.](https://community.alfresco.com/docs/DOC-6387-project-overview-records-management) + +##Getting started +What you need to get started: + +* A [Jira](https://issues.alfresco.com/jira/projects/ALF/issues/?filter=allopenissues) account, + +* A [GitHub](https://github.com/) account + +Useful but not necessary: + +* An [Alfresco community](https://community.alfresco.com/) account - this is a good place to ask questions and find answers. +##Making changes + +We use Jira to track issues if you are committing a fix for a raised issue please include the ticket number in both the merge requests and the git commit messages. +For example a fix for the ticket [ALF-21953](https://issues.alfresco.com/jira/browse/ALF-21953) will have the following git commit message: "ALF-21953: updated to use super pom v9" + +If you are Adding in a new feature or bug fix please do so [here.](https://issues.alfresco.com/jira/projects/ALF/issues/?filter=allopenissues) By raising a ticket in this project you will be agreeing to the Alfresco Contribution Agreement which can be found at the bottom of the 'Create Issue' form or alternatively attached to[this](https://community.alfresco.com/docs/DOC-7070-alfresco-contribution-agreement)page. + +When you are ready to make a change you just need to fork the [records-management](https://github.com/Alfresco/records-management) repository and then make your changes into your copy of the code. + +We have a set of standards we follow when writing code these can be found [here.](https://community.alfresco.com/docs/DOC-4658-coding-standards) + +When formatting your change please make sure not to change the format of any other code as this can make the changes difficult to spot and please make sure to use the correct line ending (we use LF) + +We ask that when adding/changing code you also add/change the appropriate unit tests and that these tests all run before creating the pull request (these will be run as part of the request it just saves time if you know they will pass before hand). + +###Writing translatable code +TODO + +##Submitting changes +When you create a pull request we will run the unit tests using Travis. If these pass a member of the team will look over the change and then assuming there are no issues will accept your change. If there are any issue we will discuss this with you using the pull request. + +It really helps speed up the review process if you include a description of the change in the pull request. + +After your change has been accepted you can add it to the page[here](https://community.alfresco.com/docs/DOC-5279-featured-contributions)to let other members of the community know (A community account is required to update this page). + +Occasionally we may have to revert a change after it has been accepted this will usually be cause by failing integration or UI tests if this happens to you feel free to get in touch for more information. + +##Additional info and links + +[Alfresco coding standards](https://community.alfresco.com/docs/DOC-4658-coding-standards) + +[Alfresco community contributions page](https://community.alfresco.com/docs/DOC-5279-featured-contributions) + +[Alfresco community site](https://community.alfresco.com/) + +[Alfresco contribution agreement](https://community.alfresco.com/docs/DOC-7070-alfresco-contribution-agreement) + +[GitHub "Records Management" code repository](https://github.com/Alfresco/records-management) + +[Jira project for raising issues/features](https://issues.alfresco.com/jira/projects/ALF/issues/?filter=allopenissues) + +[Records Management project details](https://community.alfresco.com/docs/DOC-6387-project-overview-records-management) From 6b3a552c31713ca59ac5025920113c40f845a176 Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Wed, 25 Oct 2017 14:05:45 +0100 Subject: [PATCH 3/7] RM-5792 Updating file to include changes from the initial review Mirrored from community commit b53e1b34accf10ca385a1dec8fb7baee2b746d64 --- CONTRIBUTING.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7e5896fb2b..195112c24c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,14 +15,14 @@ Useful but not necessary: * An [Alfresco community](https://community.alfresco.com/) account - this is a good place to ask questions and find answers. ##Making changes -We use Jira to track issues if you are committing a fix for a raised issue please include the ticket number in both the merge requests and the git commit messages. +We use Jira to track issues. If you are committing a fix for a raised issue please include the ticket number in both the merge requests and the git commit messages. For example a fix for the ticket [ALF-21953](https://issues.alfresco.com/jira/browse/ALF-21953) will have the following git commit message: "ALF-21953: updated to use super pom v9" -If you are Adding in a new feature or bug fix please do so [here.](https://issues.alfresco.com/jira/projects/ALF/issues/?filter=allopenissues) By raising a ticket in this project you will be agreeing to the Alfresco Contribution Agreement which can be found at the bottom of the 'Create Issue' form or alternatively attached to[this](https://community.alfresco.com/docs/DOC-7070-alfresco-contribution-agreement)page. +If you are adding in a new feature or bug fix please do so [here.](https://issues.alfresco.com/jira/projects/ALF/issues/?filter=allopenissues) By raising a ticket in this project you will be agreeing to the Alfresco Contribution Agreement which can be found at the bottom of the 'Create Issue' form or alternatively attached to[this](https://community.alfresco.com/docs/DOC-7070-alfresco-contribution-agreement)page. When you are ready to make a change you just need to fork the [records-management](https://github.com/Alfresco/records-management) repository and then make your changes into your copy of the code. -We have a set of standards we follow when writing code these can be found [here.](https://community.alfresco.com/docs/DOC-4658-coding-standards) +We have a set of standards we follow when writing code. These can be found [here.](https://community.alfresco.com/docs/DOC-4658-coding-standards) When formatting your change please make sure not to change the format of any other code as this can make the changes difficult to spot and please make sure to use the correct line ending (we use LF) @@ -38,7 +38,7 @@ It really helps speed up the review process if you include a description of the After your change has been accepted you can add it to the page[here](https://community.alfresco.com/docs/DOC-5279-featured-contributions)to let other members of the community know (A community account is required to update this page). -Occasionally we may have to revert a change after it has been accepted this will usually be cause by failing integration or UI tests if this happens to you feel free to get in touch for more information. +Occasionally we may have to revert a change after it has been accepted. This will usually be cause by failing integration or UI tests. If this happens to you feel free to get in touch for more information. ##Additional info and links From 53573ba73ef515b519789faa2cbdb322622dc837 Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Wed, 25 Oct 2017 14:27:53 +0100 Subject: [PATCH 4/7] RM-5792 Updating file to include changes from the initial review Mirrored from community commit 45f1a30eb8e504a325a667f31d0ad6af082e040c --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 195112c24c..0cc420cfc8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,5 @@ #How to contribute -Alfresco's maturity comes from the contributions of its community. Contributing back to Alfresco can be a bit confusing as Alfresco is a collection of separate open source projects. Each open source project officially sponsored by Alfresco has a page in this space detailing its governance policy and the method for reporting issues and submitting contributions. +TODO For the details on the Records Management project see[here.](https://community.alfresco.com/docs/DOC-6387-project-overview-records-management) From e899df4c711fdf92ee227752efed9a457485b44f Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Wed, 25 Oct 2017 16:08:56 +0100 Subject: [PATCH 5/7] RM-5792 Updating file to include changes from the second review Mirrored from community commit c744e70bd487f6a3ff5de55232dbee0469929a55 --- CONTRIBUTING.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0cc420cfc8..74b535af51 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,4 @@ #How to contribute -TODO - For the details on the Records Management project see[here.](https://community.alfresco.com/docs/DOC-6387-project-overview-records-management) ##Getting started @@ -28,8 +26,7 @@ When formatting your change please make sure not to change the format of any oth We ask that when adding/changing code you also add/change the appropriate unit tests and that these tests all run before creating the pull request (these will be run as part of the request it just saves time if you know they will pass before hand). -###Writing translatable code -TODO +If you are adding any user facing strings be advised these may be change after being reviewed by a member of our UA team. For UI consistency please write to these[guidelines.](http://docs.alfresco.com/sites/docs.alfresco.com/files/public/docs_team/u2/Alfresco-Writing-Guide.pdf) ##Submitting changes When you create a pull request we will run the unit tests using Travis. If these pass a member of the team will look over the change and then assuming there are no issues will accept your change. If there are any issue we will discuss this with you using the pull request. @@ -50,9 +47,15 @@ Occasionally we may have to revert a change after it has been accepted. This wil [Alfresco contribution agreement](https://community.alfresco.com/docs/DOC-7070-alfresco-contribution-agreement) +[Alfresco writing guidelines](http://docs.alfresco.com/sites/docs.alfresco.com/files/public/docs_team/u2/Alfresco-Writing-Guide.pdf) + [GitHub "Records Management" code repository](https://github.com/Alfresco/records-management) +[IDE settings for Eclipse and Intellij](https://github.com/Alfresco/records-management/tree/master/ide-config) + [Jira project for raising issues/features](https://issues.alfresco.com/jira/projects/ALF/issues/?filter=allopenissues) +[Jira project used by GS team](https://issues.alfresco.com/jira/projects/RM/issues) + [Records Management project details](https://community.alfresco.com/docs/DOC-6387-project-overview-records-management) From 6f2ccf3a988348f21536ec0fb5851845b99467a1 Mon Sep 17 00:00:00 2001 From: Tom Page Date: Thu, 26 Oct 2017 10:34:34 +0100 Subject: [PATCH 6/7] RM-5792 Minor fixes to CONTRIBUTING.md. --- CONTRIBUTING.md | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 74b535af51..d752d8da34 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,43 +1,45 @@ -#How to contribute -For the details on the Records Management project see[here.](https://community.alfresco.com/docs/DOC-6387-project-overview-records-management) +# How to contribute +For the details on the Records Management project see [here](https://community.alfresco.com/docs/DOC-6387-project-overview-records-management). -##Getting started +## Getting started What you need to get started: -* A [Jira](https://issues.alfresco.com/jira/projects/ALF/issues/?filter=allopenissues) account, +* A [Jira](https://issues.alfresco.com/jira/projects/ALF/issues/?filter=allopenissues) account; -* A [GitHub](https://github.com/) account +* A [GitHub](https://github.com/) account. Useful but not necessary: * An [Alfresco community](https://community.alfresco.com/) account - this is a good place to ask questions and find answers. -##Making changes + +## Making changes We use Jira to track issues. If you are committing a fix for a raised issue please include the ticket number in both the merge requests and the git commit messages. -For example a fix for the ticket [ALF-21953](https://issues.alfresco.com/jira/browse/ALF-21953) will have the following git commit message: "ALF-21953: updated to use super pom v9" +For example a fix for the ticket [ALF-21953](https://issues.alfresco.com/jira/browse/ALF-21953) might have the git commit message: "ALF-21953 Updated to use super pom v9". -If you are adding in a new feature or bug fix please do so [here.](https://issues.alfresco.com/jira/projects/ALF/issues/?filter=allopenissues) By raising a ticket in this project you will be agreeing to the Alfresco Contribution Agreement which can be found at the bottom of the 'Create Issue' form or alternatively attached to[this](https://community.alfresco.com/docs/DOC-7070-alfresco-contribution-agreement)page. +If you are adding in a new feature or bug fix please do so [here](https://issues.alfresco.com/jira/projects/ALF/issues/?filter=allopenissues). By raising a ticket in this project you will be agreeing to the Alfresco Contribution Agreement which can be found at the bottom of the 'Create Issue' form or alternatively attached to [this](https://community.alfresco.com/docs/DOC-7070-alfresco-contribution-agreement) page. When you are ready to make a change you just need to fork the [records-management](https://github.com/Alfresco/records-management) repository and then make your changes into your copy of the code. -We have a set of standards we follow when writing code. These can be found [here.](https://community.alfresco.com/docs/DOC-4658-coding-standards) +We have a set of standards we follow when writing code. These can be found [here](https://community.alfresco.com/docs/DOC-4658-coding-standards). -When formatting your change please make sure not to change the format of any other code as this can make the changes difficult to spot and please make sure to use the correct line ending (we use LF) +When formatting your change please try not to change the format of any other code as this can make the changes difficult to spot and please make sure to use the correct line ending (we use LF). -We ask that when adding/changing code you also add/change the appropriate unit tests and that these tests all run before creating the pull request (these will be run as part of the request it just saves time if you know they will pass before hand). +We ask that when adding/changing code you also add/change the appropriate unit tests and that these tests all run before creating the pull request (these will be run as part of the request, it just saves time if you know they will pass beforehand). -If you are adding any user facing strings be advised these may be change after being reviewed by a member of our UA team. For UI consistency please write to these[guidelines.](http://docs.alfresco.com/sites/docs.alfresco.com/files/public/docs_team/u2/Alfresco-Writing-Guide.pdf) +If you are adding any user facing strings be advised these may be change after being reviewed by a member of our UA team. For UI consistency please write to these [guidelines](http://docs.alfresco.com/sites/docs.alfresco.com/files/public/docs_team/u2/Alfresco-Writing-Guide.pdf). -##Submitting changes -When you create a pull request we will run the unit tests using Travis. If these pass a member of the team will look over the change and then assuming there are no issues will accept your change. If there are any issue we will discuss this with you using the pull request. +## Submitting changes + +When you create a pull request we will run the unit tests using [Travis](https://travis-ci.org/Alfresco/records-management). If these pass a member of the team will look over the change and then assuming there are no issues will accept your change. If there are any issue we will discuss this with you using the pull request. It really helps speed up the review process if you include a description of the change in the pull request. -After your change has been accepted you can add it to the page[here](https://community.alfresco.com/docs/DOC-5279-featured-contributions)to let other members of the community know (A community account is required to update this page). +After your change has been accepted you can add it to the page [here](https://community.alfresco.com/docs/DOC-5279-featured-contributions) to let other members of the community know. A community account is required to update this page. -Occasionally we may have to revert a change after it has been accepted. This will usually be cause by failing integration or UI tests. If this happens to you feel free to get in touch for more information. +Occasionally we may have to revert a change after it has been accepted. This will usually be caused by failing integration or UI tests. If this happens to you then feel free to get in touch for more information. -##Additional info and links +## Additional info and links [Alfresco coding standards](https://community.alfresco.com/docs/DOC-4658-coding-standards) From 78158057f1e9415a739e9e810d27407ec31a0534 Mon Sep 17 00:00:00 2001 From: Ana Bozianu Date: Fri, 27 Oct 2017 07:54:20 +0100 Subject: [PATCH 7/7] Feature/rm 5617 classify complete record with power user sm --- .../model/rma/type/RecordCategoryType.java | 10 +- .../test/util/BaseRMTestCase.java | 5 + .../test/util/UserAndGroupsUtils.java | 100 ++++++++++++++++++ 3 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/UserAndGroupsUtils.java diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryType.java index b5f35e7320..733383936c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryType.java @@ -155,7 +155,10 @@ public class RecordCategoryType extends BaseBehaviourBean public Void doWork() { // setup vital record definition - vitalRecordService.setupVitalRecordDefinition(child); + if(nodeService.exists(child)) + { + vitalRecordService.setupVitalRecordDefinition(child); + } return null; } @@ -190,7 +193,10 @@ public class RecordCategoryType extends BaseBehaviourBean public Void doWork() { // setup record category permissions - filePlanPermissionService.setupRecordCategoryPermissions(childAssocRef.getChildRef()); + if(nodeService.exists(childAssocRef.getChildRef())) + { + filePlanPermissionService.setupRecordCategoryPermissions(childAssocRef.getChildRef()); + } return null; } diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java index 166e87aaf3..44d8bba814 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java @@ -54,6 +54,7 @@ import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderServi import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; import org.alfresco.module.org_alfresco_module_rm.report.ReportService; import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.role.Role; import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; @@ -173,6 +174,9 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase protected InplaceRecordService inplaceRecordService; protected RelationshipService relationshipService; + /** test utils */ + protected UserAndGroupsUtils userAndGroupsUtils; + /** test data */ protected String siteId; protected StoreRef storeRef; @@ -340,6 +344,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase // Get the application context applicationContext = ApplicationContextHelper.getApplicationContext(getConfigLocations()); utils = new CommonRMTestUtils(applicationContext); + userAndGroupsUtils = new UserAndGroupsUtils(applicationContext); // Initialise the service beans initServices(); diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/UserAndGroupsUtils.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/UserAndGroupsUtils.java new file mode 100644 index 0000000000..c70d185648 --- /dev/null +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/UserAndGroupsUtils.java @@ -0,0 +1,100 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2017 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ + +package org.alfresco.module.org_alfresco_module_rm.test.util; + +import static org.junit.Assert.assertNotNull; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.role.Role; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AuthorityService; +import org.springframework.context.ApplicationContext; + +/** + * Test utils class containing methods for managing user, groups and roles + * + * @author Ana Manolache + * @since 2.6 + */ +public class UserAndGroupsUtils +{ + protected FilePlanRoleService filePlanRoleService; + protected AuthorityService authorityService; + + /** + * @param applicationContext the application context + */ + public UserAndGroupsUtils(ApplicationContext applicationContext) + { + filePlanRoleService = (FilePlanRoleService) applicationContext.getBean("FilePlanRoleService"); + authorityService = (AuthorityService) applicationContext.getBean("AuthorityService"); + } + + /** + * Add a user to an RM role + * + * @param userName the username of the user to add to the role + * @param role the role to add the user to + */ + public void addUserToRole(NodeRef filePlan, String userName, RMRole role) + { + // Find the authority for the given role + Role roleObj = filePlanRoleService.getRole(filePlan, role.getGroupName()); + assertNotNull("Notification role " + role.getGroupName() + " could not be retrieved", roleObj); + String roleGroup = roleObj.getRoleGroupName(); + assertNotNull("Notification role group " + roleGroup + " can not be null.", roleGroup); + + // Add user to notification role group + authorityService.addAuthority(roleGroup, userName); + } + + /** + * An enum of RM Roles + */ + public enum RMRole + { + RM_ADMINISTRATOR("Administrator"), + RM_MANAGER("RecordsManager"), + RM_POWER_USER("PowerUser"), + RM_SECURITY_OFFICER("SecurityOfficer"), + RM_USER("User"); + + private String groupName; + + private RMRole(String groupName) + { + this.groupName = groupName; + } + + public String getGroupName() + { + return this.groupName; + } + } +}