From 82a39c25634805c4e79fc4ed4d439d6a28e4cdd4 Mon Sep 17 00:00:00 2001 From: Roy Wetherall Date: Wed, 16 Apr 2014 06:02:40 +0000 Subject: [PATCH] Move, copy, link issues * RM-912: Copy to, Link to and Delete actions are available for cutoff folders/records but not working * RM-1286: Strange behavior of copied cutoff record * Relates to RM-1342 * create RM version of copy/move/link webscripts so that error reporting to client could be improved (now reasons for failure are reported) * add model behaviours for aspects that shouldn't be copied git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@67548 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org_alfresco_module_rm/log4j.properties | 5 + .../rm-model-context.xml | 15 +++ .../action/rm-copy-to.post.desc.xml | 13 +++ .../action/rm-copy-to.post.json.ftl | 2 + .../action/rm-copy-to.post.json.js | 100 ++++++++++++++++++ .../action/rm-link.post.desc.xml | 12 +++ .../action/rm-link.post.json.ftl | 2 + .../action/rm-link.post.json.js | 75 +++++++++++++ .../action/rm-move-to.post.desc.xml | 12 +++ .../action/rm-move-to.post.json.ftl | 2 + .../action/rm-move-to.post.json.js | 94 ++++++++++++++++ .../model/rma/aspect/AccendedAspect.java | 56 ++++++++++ .../model/rma/aspect/CutoffAspect.java | 56 ++++++++++ .../rma/aspect/DeclaredRecordAspect.java | 56 ++++++++++ .../rma/aspect/ExtendedSecurityAspect.java | 25 ++++- .../model/rma/aspect/TransferredAspect.java | 56 ++++++++++ .../model/rma/aspect/TransferringAspect.java | 56 ++++++++++ .../security/ModelSecurityServiceImpl.java | 2 +- 18 files changed, 636 insertions(+), 3 deletions(-) create mode 100644 rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.desc.xml create mode 100644 rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.ftl create mode 100644 rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js create mode 100644 rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.desc.xml create mode 100644 rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.ftl create mode 100644 rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js create mode 100644 rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.desc.xml create mode 100644 rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.ftl create mode 100644 rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js create mode 100644 rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/AccendedAspect.java create mode 100644 rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/CutoffAspect.java create mode 100644 rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DeclaredRecordAspect.java create mode 100644 rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferredAspect.java create mode 100644 rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferringAspect.java diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/log4j.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/log4j.properties index ce1c98b6b9..408f1b593c 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/log4j.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/log4j.properties @@ -26,6 +26,11 @@ log4j.logger.org.alfresco.module.org_alfresco_module_rm.patch=info # #log4j.logger.org.alfresco.module.org_alfresco_module_rm.job=debug +# +# Script logging level +# +log4j.logger.org.alfresco.repo.jscript.ScriptLogger=error + # # Behaviour debug # diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml index e9089b1541..a630ba8a56 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml @@ -137,6 +137,21 @@ + + + + + + + + + + + + + + + + rm-copy-to + Document List Action - Copy multiple files + /slingshot/doclib/action/rm-copy-to/site/{site}/{container}/{path} + /slingshot/doclib/action/rm-copy-to/site/{site}/{container} + /slingshot/doclib/action/rm-copy-to/node/{store_type}/{store_id}/{id}/{path} + /slingshot/doclib/action/rm-copy-to/node/{store_type}/{store_id}/{id} + /slingshot/doclib/action/rm-copy-to/node/{store_type}/{store_id} + argument + user + required + internal + diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.ftl b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.ftl new file mode 100644 index 0000000000..e2f0e9da9f --- /dev/null +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.ftl @@ -0,0 +1,2 @@ +<#import "action.lib.ftl" as actionLib /> +<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js new file mode 100644 index 0000000000..b9fde1e96d --- /dev/null +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js @@ -0,0 +1,100 @@ + + +/** + * Copy multiple files action + * @method POST + */ + +/** + * Entrypoint required by action.lib.js + * + * @method runAction + * @param p_params {object} Object literal containing files array + * @return {object|null} object representation of action results + */ +function runAction(p_params) +{ + var results = [], + destNode = p_params.destNode, + files = p_params.files, + file, fileNode, result, nodeRef, + fromSite, copiedNode; + + // Must have array of files + if (!files || files.length == 0) + { + status.setCode(status.STATUS_BAD_REQUEST, "No files."); + return; + } + + for (file in files) + { + nodeRef = files[file]; + result = + { + nodeRef: nodeRef, + action: "copyFile", + success: false + }; + + try + { + fileNode = search.findNode(nodeRef); + if (fileNode == null) + { + result.id = file; + result.nodeRef = nodeRef; + result.success = false; + result.error = "Can't find source node."; + } + else + { + result.id = fileNode.name; + result.name = fileNode.name; + result.type = fileNode.isContainer ? "folder" : "document" + + // Retain the name of the site the node is currently in. Null if it's not in a site. + fromSite = String(fileNode.siteShortName); + + // copy the node (deep copy for containers) + if (fileNode.isContainer) + { + copiedNode = fileNode.copy(destNode, true); + } + else + { + copiedNode = fileNode.copy(destNode); + } + + result.nodeRef = copiedNode.nodeRef.toString(); + result.success = (result.nodeRef != null); + + if (result.success) + { + // If this was an inter-site copy, we'll need to clean up the permissions on the node + if (fromSite != String(copiedNode.siteShortName)) + { + siteService.cleanSitePermissions(copiedNode); + } + } + } + } + catch (e) + { + result.id = file; + result.nodeRef = nodeRef; + result.success = false; + result.error = e.message; + + // log the error + logger.error(e.message); + } + + results.push(result); + } + + return results; +} + +/* Bootstrap action script */ +main(); diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.desc.xml b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.desc.xml new file mode 100644 index 0000000000..06fa861c15 --- /dev/null +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.desc.xml @@ -0,0 +1,12 @@ + + rm-link + Document List Action - Link records + /slingshot/doclib/action/rm-link/site/{site}/{container}/{path} + /slingshot/doclib/action/rm-link/site/{site}/{container} + /slingshot/doclib/action/rm-link/node/{store_type}/{store_id}/{id}/{path} + /slingshot/doclib/action/rm-link/node/{store_type}/{store_id}/{id} + argument + user + required + internal + diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.ftl b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.ftl new file mode 100644 index 0000000000..e2f0e9da9f --- /dev/null +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.ftl @@ -0,0 +1,2 @@ +<#import "action.lib.ftl" as actionLib /> +<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js new file mode 100644 index 0000000000..c2227adc8e --- /dev/null +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js @@ -0,0 +1,75 @@ + + +/** + * Add multiple files as children action + * @method POST + */ + +/** + * Entrypoint required by action.lib.js + * + * @method runAction + * @param p_params {object} Object literal containing files array + * @return {object|null} object representation of action results + */ +function runAction(p_params) +{ + var results = [], + destNode = p_params.destNode, + files = p_params.files, + file, fileNode, result, nodeRef; + + // Must have array of files + if (!files || files.length == 0) + { + status.setCode(status.STATUS_BAD_REQUEST, "No files."); + return; + } + + for (file in files) + { + nodeRef = files[file]; + result = + { + nodeRef: nodeRef, + action: "addChild", + success: false + } + + try + { + fileNode = search.findNode(nodeRef); + if (fileNode === null) + { + result.id = file; + result.nodeRef = nodeRef; + result.success = false; + } + else + { + result.id = fileNode.name; + result.name = fileNode.name; + result.type = fileNode.isContainer ? "folder" : "document"; + destNode.addNode(fileNode); + result.success = true; + } + } + catch (e) + { + result.id = file; + result.nodeRef = nodeRef; + result.success = false; + result.error = e.message; + + // log the error + logger.error(e.message); + } + + results.push(result); + } + + return results; +} + +/* Bootstrap action script */ +main(); diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.desc.xml b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.desc.xml new file mode 100644 index 0000000000..07390aa024 --- /dev/null +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.desc.xml @@ -0,0 +1,12 @@ + + rm-move-to + Document List Action - Move multiple files + /slingshot/doclib/action/rm-move-to/site/{site}/{container}/{path} + /slingshot/doclib/action/rm-move-to/site/{site}/{container} + /slingshot/doclib/action/rm-move-to/node/{store_type}/{store_id}/{id}/{path} + /slingshot/doclib/action/rm-move-to/node/{store_type}/{store_id}/{id} + argument + user + required + internal + diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.ftl b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.ftl new file mode 100644 index 0000000000..e2f0e9da9f --- /dev/null +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.ftl @@ -0,0 +1,2 @@ +<#import "action.lib.ftl" as actionLib /> +<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js new file mode 100644 index 0000000000..8b36d54881 --- /dev/null +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js @@ -0,0 +1,94 @@ + + +/** + * Move multiple files action + * @method POST + */ + +/** + * Entrypoint required by action.lib.js + * + * @method runAction + * @param p_params {object} Object literal containing files array + * @return {object|null} object representation of action results + */ +function runAction(p_params) +{ + var results = [], + destNode = p_params.destNode, + files = p_params.files, + parent = null, + file, fileNode, result, nodeRef, + fromSite; + + // Must have array of files + if (!files || files.length == 0) + { + status.setCode(status.STATUS_BAD_REQUEST, "No files."); + return; + } + + for (file in files) + { + nodeRef = files[file]; + result = + { + nodeRef: nodeRef, + action: "moveFile", + success: false + } + + try + { + fileNode = search.findNode(nodeRef); + if (fileNode == null) + { + result.id = file; + result.nodeRef = nodeRef; + result.success = false; + } + else + { + if (p_params.parent && p_params.parent != null) + { + parent = search.findNode(p_params.parent); + } + result.id = fileNode.name; + result.name = fileNode.name; + result.type = fileNode.isContainer ? "folder" : "document"; + + // Retain the name of the site the node is currently in. Null if it's not in a site. + fromSite = fileNode.siteShortName; + + // move the node + result.success = fileNode.move(parent, destNode); + + if (result.success) + { + // If this was an inter-site move, we'll need to clean up the permissions on the node + if (String(fromSite) !== String(fileNode.siteShortName)) + { + siteService.cleanSitePermissions(fileNode); + } + } + } + } + catch (e) + { + result.id = file; + result.nodeRef = nodeRef; + result.success = false; + result.error = e.message; + + // log the error + logger.error(e.message); + } + + results.push(result); + } + + return results; +} + +/* Bootstrap action script */ +main(); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/AccendedAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/AccendedAspect.java new file mode 100644 index 0000000000..a20184ad50 --- /dev/null +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/AccendedAspect.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2005-2014 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * 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 . + */ +package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; + +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; +import org.alfresco.repo.copy.DoNothingCopyBehaviourCallback; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.service.namespace.QName; + +/** + * rma:ascended behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:ascended" +) +public class AccendedAspect extends BaseBehaviourBean +{ + /** + * Copy callback. + * + * Aspect should not be copied. + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) + { + return new DoNothingCopyBehaviourCallback(); + } +} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/CutoffAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/CutoffAspect.java new file mode 100644 index 0000000000..5cd310678b --- /dev/null +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/CutoffAspect.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2005-2014 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * 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 . + */ +package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; + +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; +import org.alfresco.repo.copy.DoNothingCopyBehaviourCallback; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.service.namespace.QName; + +/** + * rma:cutoff behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:cutOff" +) +public class CutoffAspect extends BaseBehaviourBean +{ + /** + * Copy callback. + * + * Cutoff aspect should not be copied. + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) + { + return new DoNothingCopyBehaviourCallback(); + } +} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DeclaredRecordAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DeclaredRecordAspect.java new file mode 100644 index 0000000000..2299e34100 --- /dev/null +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DeclaredRecordAspect.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2005-2014 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * 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 . + */ +package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; + +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; +import org.alfresco.repo.copy.DoNothingCopyBehaviourCallback; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.service.namespace.QName; + +/** + * rma:declaredRecord behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:declaredRecord" +) +public class DeclaredRecordAspect extends BaseBehaviourBean +{ + /** + * Copy callback. + * + * Aspect should not be copied. + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) + { + return new DoNothingCopyBehaviourCallback(); + } +} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ExtendedSecurityAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ExtendedSecurityAspect.java index deb84acf42..654105cbd6 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ExtendedSecurityAspect.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ExtendedSecurityAspect.java @@ -22,6 +22,9 @@ import java.util.Set; import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; +import org.alfresco.repo.copy.DoNothingCopyBehaviourCallback; import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.policy.Behaviour.NotificationFrequency; import org.alfresco.repo.policy.annotation.Behaviour; @@ -31,6 +34,7 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; /** * rma:extendedSecurity behaviour bean @@ -55,6 +59,21 @@ public class ExtendedSecurityAspect extends BaseBehaviourBean { this.extendedSecurityService = extendedSecurityService; } + + /** + * Copy callback. + * + * Aspect should not be copied. + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) + { + return new DoNothingCopyBehaviourCallback(); + } /** * Update extended security when moving a node. @@ -64,8 +83,8 @@ public class ExtendedSecurityAspect extends BaseBehaviourBean @Override @Behaviour ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT ) public void onMoveNode(final ChildAssociationRef origAssoc, final ChildAssociationRef newAssoc) { @@ -89,4 +108,6 @@ public class ExtendedSecurityAspect extends BaseBehaviourBean }); } + + } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferredAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferredAspect.java new file mode 100644 index 0000000000..dcf26dd4bb --- /dev/null +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferredAspect.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2005-2014 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * 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 . + */ +package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; + +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; +import org.alfresco.repo.copy.DoNothingCopyBehaviourCallback; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.service.namespace.QName; + +/** + * rma:transferred behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:transferred" +) +public class TransferredAspect extends BaseBehaviourBean +{ + /** + * Copy callback. + * + * Aspect should not be copied. + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) + { + return new DoNothingCopyBehaviourCallback(); + } +} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferringAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferringAspect.java new file mode 100644 index 0000000000..24158470a1 --- /dev/null +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferringAspect.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2005-2014 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * 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 . + */ +package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; + +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; +import org.alfresco.repo.copy.DoNothingCopyBehaviourCallback; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.service.namespace.QName; + +/** + * rma:transferring behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:transferring" +) +public class TransferringAspect extends BaseBehaviourBean +{ + /** + * Copy callback. + * + * Aspect should not be copied. + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) + { + return new DoNothingCopyBehaviourCallback(); + } +} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityServiceImpl.java index 66a36e655f..1ba508273c 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityServiceImpl.java @@ -288,7 +288,7 @@ public class ModelSecurityServiceImpl extends BaseBehaviourBean throw new ModelAccessDeniedException( "The user " + AuthenticationUtil.getFullyAuthenticatedUser() + " does not have the permission to add the protected aspect " + aspect.toPrefixString(namespaceService) + - " from the node " + nodeRef.toString()); + " to the node " + nodeRef.toString()); } }